On Sun, 21 Apr 2013, Steven D'Aprano wrote:

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?

from __future__ import division, print_function

from future_builtins import *

This is the route I recommend, and take myself. Usually I'll do:

from __future__ import print_function, division, unicode_literals

try:
    input = raw_input
    range = xrange
except NameError:
    pass #using python 3 already, whee!


which makes you able to write code that mostly looks to Python3.


You could also look at how Django does their 2/3 support: https://www.djangoproject.com/weblog/2012/aug/19/experimental-python-3-support/

Looks like they use the `six` library:
http://pythonhosted.org/six/


HTH,
-W
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to