what is the difference between one-line-operation and 2-line-operation

Michael Torrie torriem at gmail.com
Mon Apr 25 10:46:31 EDT 2016


On 04/25/2016 08:13 AM, oyster wrote:
> so, what produces this difference between py2 and py3 in nature? is
> there more examples? where can I find the text abiut his difference?

One thing I see is that both your py2 and py3 examples are treating
print as a function.  It's only a function in Py3. By default in Py2
it's a statement.  You passed it a tuple, and that's what it prints.  If
you add:

from __future__ import print_function

then py2 and py3 will behave the same in regards to print.




More information about the Python-list mailing list