Django and Python 3
alexgaynor.net
alexgaynor.net
1. Port the dispatcher to P3.
2. Do something magic with urls.py, so you choose which version (2.X or 3.X) you want doing the query.
At this point, people can use URL plumbing to gradually port their Django projects.
3. Port the parts where Python 3 is a killer feature. String formatting, Unicode handling (maybe), function decorators, and metaclasses. This is the hard part - where would python 3 add some killer features to django?
You also need to do the db layer, the templating, and all that jazz, but that should follow once you have the incentive of actually seeing it work in your browser.
The holdup here is not technical. It's great that we've got people like Alex willing to port code, but that's not the hard part. The hard part is people who are using and want to continue using Django on platforms where Python 2.5 or even 2.4 is still the standard.
More on this forthcoming, once I've had a proper weekend off.
EDIT: I'd have thought upgrading the codebase to 3.x and making sure that 3to2 produces a working 2.4 version would be better than using 2to3. Thoughts?
2.4 only supports this:
try:
do stuff
except FooError, e:
do stuff with e
3.0 and up choke on this; they interpret it as "catch exceptions of type FooError or e and do not give the exception object a name".2.5 through 2.7 interpret like 2.4 but also support explicit parentheses to do what Python 3 does:
try:
do stuff
except (FooError, BarError) as e:
do stuff
except (BazError, QuxError):
do other stuff
2to3 requires that you use the new exception syntax only, to avoid confusion. import sys
try:
fn()
except (IOError, TypeError):
err = sys.exc_info()[1]
print(err)
http://docs.pythonsprints.com/python3_porting/py-porting.htm...Plus Google decides GSoC students on a per project basis and the project's core developers get the pick the students; and Alex, already is a core developer.