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


Groups > comp.lang.python > #16600

Re: Python 2 or 3

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed5.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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'test,': 0.04; 'subject:Python': 0.05; 'imports': 0.07; 'python': 0.08; 'coding,': 0.09; 'nicely': 0.09; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; '\xa0to': 0.16; 'wrote:': 0.18; 'appropriate': 0.22; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'versions': 0.23; 'least,': 0.23; 'code': 0.25; 'work.': 0.28; 'message-id:@mail.gmail.com': 0.28; 'modules,': 0.30; 'sun,': 0.30; 'translate': 0.31; 'to:addr:python-list': 0.34; 'things': 0.34; 'run': 0.37; 'received:google.com': 0.37; 'enough': 0.38; 'received:209.85': 0.38; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'target': 0.63; 'care': 0.71
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=RN7GQWpOP5uvC0fzxlqmKs4xy2u2/hVg3yIxl6BcTOU=; b=O+KlXHYMChXH0wunHdwiFwgAN4ZSZBCeUiVW34CFcM/TthA3drFzjGgmzTd3EqBGLv SNVidS7+U3RvI+d30oqphcaL+VH7Pe4J47NLeYWHRvszSHnzDeUF1GpFJBYU7cWZxLfl r/8vRveb+cHP6yXA13sqfUCD1y8I8vK3+bftc=
MIME-Version 1.0
In-Reply-To <jbe2jt$v0c$1@dough.gmane.org>
References <O3hCq.1112$Ci1.79@uutiset.elisa.fi> <jbe2jt$v0c$1@dough.gmane.org>
Date Sun, 4 Dec 2011 13:52:23 +1100
Subject Re: Python 2 or 3
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3257.1322967146.27778.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322967146 news.xs4all.nl 6949 [2001:888:2000:d::a6]:57814
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16600

Show key headers only | View raw


On Sun, Dec 4, 2011 at 7:59 AM, Gelonida N <gelonida@gmail.com> wrote:
> if you write code nicely enough in python 2, then you can translate it
>  to python 3. autmatically.

It's entirely possible to write code that can run on both Python 2 and
Python 3  - at least, if you can target 2.6/2.7 and get the
appropriate future directives. Add in a few exception-guarded imports
for the renamed modules, and then all you're left with is a few things
where you can take a little care while coding, run it through both
versions to test, and have it all work.

ChrisA

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


Thread

Python 2 or 3 Antti J Ylikoski <antti.ylikoski@tkk.fi> - 2011-12-03 05:54 +0200
  Re: Python 2 or 3 Gnarlodious <gnarlodious@gmail.com> - 2011-12-02 20:10 -0800
  Re: Python 2 or 3 Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-02 22:20 -0600
  Re: Python 2 or 3 Roy Smith <roy@panix.com> - 2011-12-02 23:27 -0500
  Re: Python 2 or 3 Dan Stromberg <drsalists@gmail.com> - 2011-12-02 20:42 -0800
  Re: Python 2 or 3 Terry Reedy <tjreedy@udel.edu> - 2011-12-03 01:23 -0500
  Re: Python 2 or 3 Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-03 00:37 -0600
  Re: Python 2 or 3 Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-03 00:41 -0600
  Re: Python 2 or 3 jmfauth <wxjmfauth@gmail.com> - 2011-12-03 00:59 -0800
  Re: Python 2 or 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-03 10:04 +0000
    Re: Python 2 or 3 Chris Angelico <rosuav@gmail.com> - 2011-12-03 21:44 +1100
  Re: Python 2 or 3 Arnaud Delobelle <arnodel@gmail.com> - 2011-12-03 12:03 +0000
  Re: Python 2 or 3 Gelonida N <gelonida@gmail.com> - 2011-12-03 21:59 +0100
  Re: Python 2 or 3 Chris Angelico <rosuav@gmail.com> - 2011-12-04 13:52 +1100
  Re: Python 2 or 3 Terry Reedy <tjreedy@udel.edu> - 2011-12-03 21:52 -0500
  Re: Python 2 or 3 Chris Angelico <rosuav@gmail.com> - 2011-12-04 14:02 +1100
  Re: Python 2 or 3 Zaphod <zaphod@beeblebrox.net> - 2011-12-04 20:18 +0000
  Re: Python 2 or 3 Tobiah <tobiah@teranews.com> - 2011-12-06 09:33 -0800
    Re: Python 2 or 3 Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2011-12-10 00:16 +0100
      Re: Python 2 or 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-10 00:19 +0000
        Re: Python 2 or 3 Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2011-12-10 12:49 +0100

csiph-web