Python Forum
version 2 to 3 changes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: version 2 to 3 changes (/thread-5697.html)



version 2 to 3 changes - Skaperen - Oct-17-2017

as we all know, version 3 changed the print statement to a built in print() function.  i am curious why and also curious why not other statements.


RE: version 2 to 3 changes - ichabod801 - Oct-17-2017

PEP 3105.


RE: version 2 to 3 changes - Larz60+ - Oct-17-2017

Here's the PEP: https://www.python.org/dev/peps/pep-3101/

I like the even newer python 3.6 version better.


RE: version 2 to 3 changes - Skaperen - Oct-18-2017

what PEP describes the changes to print() in 3.6?

when i was just getting started with python, one of the first things i created was a function to do printing.  it had the name pr() only because "print" was a reserved word.  but i got all the ability of having print as a function.  today, knowing more, if i still needed to do this, i'd add a few more features.  but i still don't see the reason to do this in the language itself, other than a module needed to be imported (this could have been added to the interpreter, to auto-import certain modules).  and, still, why not (also) some other things, like the del statement?

also, why not a transition phase, where both the function and the statement could coexist?


RE: version 2 to 3 changes - Larz60+ - Oct-18-2017

Quote:what PEP describes the changes to print() in 3.6?
https://www.python.org/dev/peps/pep-0498/

It's interesting, when I began (for the 2nd time) to use python, the only
complaint I had was with indentation.

I never think about it when writing code anymore, only (every day) when trying to get new users
to properly post code.

from the early 1980's until I retired, the main languages that I used were C and C++, with a few years
of forth (which I loved by the way, but it tended to be a write only language, like Perl).