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

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
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 Mon, 25 Apr 2016 08:46:31 -0600
Lines 13
Message-ID <mailman.82.1461595617.32212.python-list@python.org> (permalink)
References <CACW-qXU_b9G3016m12FgqgUEhGE-QkioiXacQOCAHrRrVzbQPg@mail.gmail.com> <571E2DC7.6090902@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de RXuaAiaopSHCQvdAIy47IgWoTsSWnSJRVKGwf2aKYKCg==
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '__future__': 0.09; 'behave': 0.09; 'subject: \n ': 0.15; 'examples?': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'oyster': 0.16; 'py3': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'statement.': 0.16; 'subject:between': 0.16; 'tuple,': 0.16; 'wrote:': 0.16; 'produces': 0.22; 'am,': 0.23; 'import': 0.24; 'examples': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'function': 0.28; 'subject:what': 0.29; 'print': 0.30; 'message-id:@gmail.com': 0.34; 'so,': 0.35; 'text': 0.35; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'difference': 0.38; 'subject:the': 0.39; 'received:192': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'your': 0.60; 'default': 0.61; 'charset:windows-1252': 0.62; 'more': 0.63; 'between': 0.65; 'add:': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2
In-Reply-To <CACW-qXU_b9G3016m12FgqgUEhGE-QkioiXacQOCAHrRrVzbQPg@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <571E2DC7.6090902@gmail.com>
X-Mailman-Original-References <CACW-qXU_b9G3016m12FgqgUEhGE-QkioiXacQOCAHrRrVzbQPg@mail.gmail.com>
Xref csiph.com comp.lang.python:107609

Show key headers only | 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