[Python-ideas] A suggestion for Python 3 vs Python 2

אלעזר elazarg at gmail.com
Wed Nov 13 20:22:02 CET 2013


2013/11/13 anatoly techtonik <techtonik at gmail.com>:
> So, what's wrong with supporting both:
> 1. print xxx   - as a statement (which maps to function call)
> 2. print(xxx)  - as an expression (which is a function call)
>

Python2:
>>> print (1,2)
(1, 2)

Python3:
>>> print (1,2)
1 2

What is your suggestion? Repeat Ruby's failure to make function call
whitespace-insensitive?

>>> print(1,2)
1 2
>>> print (1,2)
(1,2)

That's horrible.

Besides, how do you want code like this one to behave?

>>> print = log
>>> print xxx

Or this:

>>> import builtins
>>> builtins.print = log
>>> print xxx

I think it simply not worth it.

Elazar


More information about the Python-ideas mailing list