Python 2 or 3

Chris Angelico rosuav at gmail.com
Sat Dec 3 21:52:23 EST 2011


On Sun, Dec 4, 2011 at 7:59 AM, Gelonida N <gelonida at 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



More information about the Python-list mailing list