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: 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: References: Date: Sun, 4 Dec 2011 13:52:23 +1100 Subject: Re: Python 2 or 3 From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sun, Dec 4, 2011 at 7:59 AM, Gelonida N wrote: > if you write code nicely enough in python 2, then you can translate it > =A0to 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