Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Why has python3 been created as a seperate language where thereis still python2.7 ?

Reply
Thread Tools

Re: Why has python3 been created as a seperate language where thereis still python2.7 ?

 
 
Michiel Overtoom
Guest
Posts: n/a
 
      06-25-2012

On Jun 24, 2012, at 05:46, gmspro wrote:

> Why has python3 been created as a seperate language where there is still python2.7?


It has not. Python2 and Python3 are very similar. It's not like if you learn Python using version 2, you have to relearn the language when you want to switch Python3. The syntax is the same, only 'print' is a function instead of a statement. Other improvements are unicode strings, cleanups in the library, lazy iterators, new-style classes by default etc... mostly background stuff you won't even notice in daily Python use.

Greetings,

--
Test your knowledge of flowers! http://www.learn-the-flowers.com
or http://www.leer-de-bloemen.nl for the Dutch version.

Test je kennis van bloemen! http://www.leer-de-bloemen.nl
of http://www.learn-the-flowers.com voor de Engelse versie.




 
Reply With Quote
 
 
 
 
rantingrickjohnson@gmail.com
Guest
Posts: n/a
 
      06-26-2012
On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
> It has not. Python2 and Python3 are very similar. It's not like if
> you learn Python using version 2, you have to relearn the language
> when you want to switch Python3. The syntax is the same, only
> 'print' is a function instead of a statement.


However, there is something to be said for "old habits die hard". I myself lament every time i must type->(, then blah, then->) AGAIN!. My fingers are hardwired for the old print statement. Damned that Guido and his mind games!

http://www.youtube.com/watch?v=-Ny42Mdg5qo
 
Reply With Quote
 
 
 
 
rantingrickjohnson@gmail.com
Guest
Posts: n/a
 
      06-26-2012
On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
> It has not. Python2 and Python3 are very similar. It's not like if
> you learn Python using version 2, you have to relearn the language
> when you want to switch Python3. The syntax is the same, only
> 'print' is a function instead of a statement.


However, there is something to be said for "old habits die hard". I myself lament every time i must type->(, then blah, then->) AGAIN!. My fingers are hardwired for the old print statement. Damned that Guido and his mind games!

http://www.youtube.com/watch?v=-Ny42Mdg5qo
 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      06-26-2012
(Rick, don't make me regret communicating with you again.)

On Mon, 25 Jun 2012 19:28:01 -0700, rantingrickjohnson wrote:

> However, there is something to be said for "old habits die hard". I
> myself lament every time i must type->(, then blah, then->) AGAIN!. My
> fingers are hardwired for the old print statement. Damned that Guido and
> his mind games!


There's no real difference between typing print(...) and all the other
functions in Python. Do you lament having to type len(obj) instead of
"len obj" or list(zip(a, b, c)) instead of "list zip a b c"?

Making print a statement in the first place was a mistake, but
fortunately it was a simple enough mistake to rectify once the need for
backward compatibility was relaxed.


--
Steven
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      06-26-2012
On 6/25/2012 11:35 PM, Steven D'Aprano wrote:
> (Rick, don't make me regret communicating with you again.)
>
> On Mon, 25 Jun 2012 19:28:01 -0700, rantingrickjohnson wrote:
>
>> However, there is something to be said for "old habits die hard". I
>> myself lament every time i must type->(, then blah, then->) AGAIN!. My
>> fingers are hardwired for the old print statement. Damned that Guido and
>> his mind games!

>
> There's no real difference between typing print(...) and all the other
> functions in Python.


Yes there is ... as Rick said, habit. I still sometimes forget ;-(

> Do you lament having to type len(obj) instead of
> "len obj" or list(zip(a, b, c)) instead of "list zip a b c"?


No.

> Making print a statement in the first place was a mistake, but
> fortunately it was a simple enough mistake to rectify once the need for
> backward compatibility was relaxed.


Complete agreed. I have used all of sep=, end=, and file= at various times.

--
Terry Jan Reedy



 
Reply With Quote
 
Jeremiah Dodds
Guest
Posts: n/a
 
      06-26-2012
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:

> On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
>> It has not. Python2 and Python3 are very similar. It's not like if
>> you learn Python using version 2, you have to relearn the language
>> when you want to switch Python3. The syntax is the same, only
>> 'print' is a function instead of a statement.

>
> However, there is something to be said for "old habits die hard". I myself
> lament every time i must type->(, then blah, then->) AGAIN!. My fingers are
> hardwired for the old print statement. Damned that Guido and his mind games!
>
> http://www.youtube.com/watch?v=-Ny42Mdg5qo


I'm of the opinion that the solution to this involves configuring your editor.
 
Reply With Quote
 
Devin Jeanpierre
Guest
Posts: n/a
 
      06-26-2012
On Mon, Jun 25, 2012 at 11:35 PM, Steven D'Aprano
<(E-Mail Removed)> wrote:
> There's no real difference between typing print(...) and all the other
> functions in Python. Do you lament having to type len(obj) instead of
> "len obj" or list(zip(a, b, c)) instead of "list zip a b c"?


Surely you mean "list $ zip a b c"?

But yes, it's really not a big deal. It's a trivial change, and one
that 2to3 can handle really easily.

>
> Making print a statement in the first place was a mistake, but
> fortunately it was a simple enough mistake to rectify once the need for
> backward compatibility was relaxed.


Hmmm, why is the function so much better than the statement? You like
using it in expressions? Or is it that you like passing it in as a
callback?

-- Devin
 
Reply With Quote
 
Stefan Behnel
Guest
Posts: n/a
 
      06-26-2012
Jeremiah Dodds, 26.06.2012 07:04:
> (E-Mail Removed) writes:
>
>> On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
>>> It has not. Python2 and Python3 are very similar. It's not like if
>>> you learn Python using version 2, you have to relearn the language
>>> when you want to switch Python3. The syntax is the same, only
>>> 'print' is a function instead of a statement.

>>
>> However, there is something to be said for "old habits die hard". I myself
>> lament every time i must type->(, then blah, then->) AGAIN!. My fingers are
>> hardwired for the old print statement. Damned that Guido and his mind games!
>>
>> http://www.youtube.com/watch?v=-Ny42Mdg5qo

>
> I'm of the opinion that the solution to this involves configuring your editor.


But wasn't the whole idea behind Python to be accessible for innocent
users? Isn't the one and only acceptable goal of a language cleanup that
those who do not have the expert knowledge to configure the editor of their
choice should finally be able to wholeheartedly type down their Pythonish
code without having the parser allude them to the one holy way from time to
time? It clearly cannot have achieved that goal, given the amount of
traffic on this list, can it?

Maybe we should add a remote error reporting mode to Python that sends all
syntax error messages not only to the local screen but also directly to the
PSF so that they can fund developers who are able to delete that error
message from the interpreter based on real world statistical evidence. That
would eventually make the language match the powerset of what all users
have in their fingers. A very worthy goal, if you ask me.

Stefan

 
Reply With Quote
 
Stefan Behnel
Guest
Posts: n/a
 
      06-26-2012
Devin Jeanpierre, 26.06.2012 08:15:
> On Mon, Jun 25, 2012 at 11:35 PM, Steven D'Aprano
>> Making print a statement in the first place was a mistake, but
>> fortunately it was a simple enough mistake to rectify once the need for
>> backward compatibility was relaxed.

>
> Hmmm, why is the function so much better than the statement? You like
> using it in expressions? Or is it that you like passing it in as a
> callback?


First of all, the statement has a rather special syntax that is not obvious
and practically non-extensible. It also has hidden semantics that are hard
to explain and mixes formatting with output - soft-space, anyone?

The function is straight forward, configurable, does one thing, works with
help() and doesn't get in the way. And something as rarely[1] used as a
print simply doesn't deserve special syntax. Oh, and, yes, you can even
pass it into some code as callback, although I rarely had a need for that.

Stefan


[1] Seriously, it's not very helpful in interactive mode and too simplistic
to be used in application code. Even scripts often work better with logging
than with prints.

 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      06-26-2012
On Tue, 26 Jun 2012 02:15:17 -0400, Devin Jeanpierre wrote:

>> Making print a statement in the first place was a mistake, but
>> fortunately it was a simple enough mistake to rectify once the need for
>> backward compatibility was relaxed.

>
> Hmmm, why is the function so much better than the statement? You like
> using it in expressions? Or is it that you like passing it in as a
> callback?


Simplicity: there doesn't seem to be anything special about print that
requires it to be syntax instead of just a built-in function. Nearly
everything else which is handled by syntax is special: assignment,
deletion, imports, flow control. (Decorators are the obvious exception,
but they are pure syntactic sugar.)

Consistency: print as a function isn't a special case to be learned.
There's no need to memorise magic syntax to control it, you just pass
ordinary arguments using ordinary syntax. Instead of arcane and bizarre
special cases like this:

print >>sys.stderr, spam, ham, eggs,

you just use:

print(spam, ham, eggs, file=sys.stderr, end='')

While it's a tad longer, there's no special syntax to be learned.

Practicality: as a function, you can use print anywhere you can use other
functions. You can bind it to another name, pass it as argument to
another function such as help(), store it in a list, use it as a
callback, or monkey-patch it, without needing to write a wrapper
"print_" (or "prnt", "pr", etc.) around it.


Compare that to print as a statement, which only has one argument in
favour: backwards compatibility.



--
Steven
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why the destructor executes after its friend operator (in which thereis a copy constructor) runs fl C++ 5 01-06-2013 08:32 PM
Re: Why has python3 been created as a seperate language where thereis still python2.7 ? Stefan Behnel Python 3 06-26-2012 10:37 PM
Re: Why has python3 been created as a seperate language where thereis still python2.7 ? Andrew Berg Python 0 06-25-2012 08:48 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM



Advertisments