Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107609

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

From Michael Torrie <torriem@gmail.com>
Newsgroups comp.lang.python
Subject Re: what is the difference between one-line-operation and 2-line-operation
Date 2016-04-25 08:46 -0600
Message-ID <mailman.82.1461595617.32212.python-list@python.org> (permalink)
References <CACW-qXU_b9G3016m12FgqgUEhGE-QkioiXacQOCAHrRrVzbQPg@mail.gmail.com> <571E2DC7.6090902@gmail.com>

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: what is the difference between one-line-operation and 2-line-operation Michael Torrie <torriem@gmail.com> - 2016-04-25 08:46 -0600

csiph-web