[Tutor] 3to2?
Steven D'Aprano
steve at pearwood.info
Sun Apr 21 07:32:44 CEST 2013
On 21/04/13 04:32, Jim Mooney wrote:
> I was looking at google pengine for python and it only supports 2.7. I've
> installed 3 and would rather not go back (I kept doing Print without the
> parentheses for awhile and it was really annoying ;')
>
> So the question comes up. If there is a 2to3 script, which I got working,
> is there a 3to2 script?. Or does that even makes sense since 3 has features
> 2 does not, although I read somewhere that many have been backported?
Is google broken in your part of the world? *wink*
https://duckduckgo.com/html/?q=python+3to2
https://www.google.com.au/search?q=python+3to2
http://au.search.yahoo.com/search?p=python+3to2
http://www.bing.com/search?q=python+3to2
Some features of Python 3 have already been back-ported, like the with
statement. Some can be optionally enabled, e.g.:
from __future__ import division, print_function
from future_builtins import *
In general, provided you only care about Python 2.7, you can write code
which behaves the same way in both 2 and 3. But as you go further back,
it becomes harder and harder. By the time you're trying to support 2.4
onwards, it becomes very annoying, and I'm speaking from experience.
Although I see that CherryPy actually manages to support everything from
2.3 onwards using a single code base, which truly astonishes me!
--
Steven
More information about the Tutor
mailing list