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


Groups > comp.lang.python > #62781

Re: So, what's the real story on Python 2 vs Python 3?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'syntax': 0.04; 'subject:Python': 0.06; 'explicit': 0.07; 'prefix': 0.09; 'cc:addr :python-list': 0.11; '__future__': 0.16; 'above)': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imports': 0.16; 'newer,': 0.16; 'wrote:': 0.18; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'relative': 0.30; 'message-id:@mail.gmail.com': 0.30; 'subject:what': 0.31; 'fri,': 0.33; 'style': 0.33; 'subject:the': 0.34; 'classes': 0.35; 'received:google.com': 0.35; '2.6': 0.36; 'subject:?': 0.36; 'two': 0.37; 'saves': 0.38; 'pm,': 0.38; 'anything': 0.39; 'even': 0.60; 'skip:u 10': 0.60; 'new': 0.61; 'dont': 0.67; 'funny': 0.74; '(ie': 0.84; 'everything.': 0.84; 'to:none': 0.92; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Z9dvEp3YioeCVsPxWSdG9TU1ZBkaVQd1B3/mdNfcXn4=; b=DQY4XNxQ9CL3dEwMifN46WwnLRGl2Q4nYW0Y2Hrj0xnWb3q3j1gh63alOR2zjPOdr+ 0sEVeuHNhFg4NWgrHsQrgEy53zKs9IbMxVliJIOZMY4i15qw8oXFcFTxparZ7xRWqC/D IF3JWuJH2w8A3h30eIwBZa0+4l3kjdZl5lIcYZRzcOlU6J0wFUdR1gAw1A9KXuLj4PrF OWiN35Qi/1qOtDBhDfNR7Ib8FvyXoogx5YKsIVhaBxTj5InDmkWgBoQTjZ4zgiLwWt5q 7m7CqIMVUpWdXr/IjTCM9k1pVxXpIYj826OyxwSbG3ktUsSA3oS/V+JX0+d+fxHbx+Rt krcw==
MIME-Version 1.0
X-Received by 10.68.247.6 with SMTP id ya6mr43102727pbc.45.1388124039845; Thu, 26 Dec 2013 22:00:39 -0800 (PST)
In-Reply-To <CAJ+TeocpeU2d4R-uNrzCyt1B6w55gbdsyenJBp3SaUgpefBL7g@mail.gmail.com>
References <XT7vu.64127$Qi4.25759@fx11.iad> <52BD0E12.3040108@gmail.com> <CAJ+TeocpeU2d4R-uNrzCyt1B6w55gbdsyenJBp3SaUgpefBL7g@mail.gmail.com>
Date Fri, 27 Dec 2013 17:00:39 +1100
Subject Re: So, what's the real story on Python 2 vs Python 3?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.4657.1388124048.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388124048 news.xs4all.nl 2829 [2001:888:2000:d::a6]:38867
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62781

Show key headers only | View raw


On Fri, Dec 27, 2013 at 4:43 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> 1. print: Use print with (). Dont use funny 2 syntax
> 2. Always write strings with a u" prefix
> 3. Always use new style classes
> 4. Always use relative imports with explicit relative (ie use .)

Even easier:

1. from __future__ import print_function
2. from __future__ import unicode_literals
(3 and 4 as per your above)

For anything 2.6 or newer, those two will give Py3 behaviour, at least
in those two ways. Saves you having to put the explicit u prefix on
everything.

ChrisA

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


Thread

So, what's the real story on Python 2 vs Python 3? Travis McGee <nobody@nowhere.com> - 2013-12-27 00:04 -0500
  Re: So, what's the real story on Python 2 vs Python 3? Roy Smith <roy@panix.com> - 2013-12-27 00:07 -0500
    Re: So, what's the real story on Python 2 vs Python 3? Chris Angelico <rosuav@gmail.com> - 2013-12-27 16:14 +1100
  Re: So, what's the real story on Python 2 vs Python 3? Andrew Berg <robotsondrugs@gmail.com> - 2013-12-26 23:20 -0600
    Re: So, what's the real story on Python 2 vs Python 3? Grant Edwards <invalid@invalid.invalid> - 2014-01-02 16:34 +0000
  Re: So, what's the real story on Python 2 vs Python 3? Dan Stromberg <drsalists@gmail.com> - 2013-12-26 21:29 -0800
  Re: So, what's the real story on Python 2 vs Python 3? Rustom Mody <rustompmody@gmail.com> - 2013-12-27 11:13 +0530
  Re: So, what's the real story on Python 2 vs Python 3? Chris Angelico <rosuav@gmail.com> - 2013-12-27 17:00 +1100
  Re: So, what's the real story on Python 2 vs Python 3? Dan Stromberg <drsalists@gmail.com> - 2013-12-26 22:23 -0800
  Re: So, what's the real story on Python 2 vs Python 3? Rustom Mody <rustompmody@gmail.com> - 2013-12-27 16:21 +0530
  Re: So, what's the real story on Python 2 vs Python 3? Chris Angelico <rosuav@gmail.com> - 2013-12-27 22:06 +1100
    Re: So, what's the real story on Python 2 vs Python 3? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-27 22:34 +1100
      Re: So, what's the real story on Python 2 vs Python 3? Chris Angelico <rosuav@gmail.com> - 2013-12-27 22:46 +1100
  Re: So, what's the real story on Python 2 vs Python 3? Ned Batchelder <ned@nedbatchelder.com> - 2013-12-27 07:13 -0500
  Re: So, what's the real story on Python 2 vs Python 3? Grant Edwards <invalid@invalid.invalid> - 2014-01-02 16:28 +0000

csiph-web