views:

588

answers:

5

I have been learning python for some time now. While starting this "learning python" endeavor I decided to learn the latest and greatest 3.1 version of python. I regret this decision now because I wanted to try my hands on some of the python web development frameworks & it looks like many of them do not support 3.1 yet & it looks like it might take them years to support the new version of Python especially Django and TurboGears. This is really disappointing. Therefore, SO users, do you have any recommendation for a web framework for me that runs on 3.1 and supports some of the modern (I guess I will never learn ;-)) web framework features like MVC/ORM/URL Routing/Caching etc. Many thanks for your response.

+4  A: 

How about trying Python2.7?, many of python 3.x features are backported to 2.7 recently, like OrderedDict, faster io modules, set comprehensions, dict comprehensions, etc...

And Python 2.7 is running no problem at all with django 1.2 trunk version in my experience.

In my opinion, learning new framework will take more time than switching from Python2.x to Python3.x, So choose one framework, and just keep using python 2.x and switch it to 3.x when the time come.

S.Mark
Very true about the difference in the time to learn a different framework vs switching from Python 2.x to 3.x
Echo
+1  A: 

Python 2.6 and Python 3.1 are really not all that different, I simply suggest you learn both, especially since both branches of Python are going to coexist for a while... so best to just learn the slight differences. The document "What's New in Python 3.0" explains most of the differences between 2.6 and 3.0.

Michael Aaron Safyan
+3  A: 

Like the others, I would suggest you start with Python 2.6.x -- Python 2.7 will be released this summer although you can grab an alpha or beta version today.

Although Python 3.x is backwards-incompatible with 2.x, Python syntax isn't going to be unrecognizable... pretty much everything is very similar to 2.x, but it's easy to break code when print changes from a statement to a function. So don't worry about Python 3 for now. As others have mentioned, you can get started right away with plenty of web frameworks that work in Python 2.x.

Also, just because of the numbering, do NOT be fooled in thinking that Python 2 is obsolete in any way nor can you follow the timeline serially. In other words, Python 2.7 will be newer than both Python 3.0 and 3.1. (3.2 won't be released until the end of this year.) Again, Python 2 has NOT been EOL'd -- both 2.x and 3.x are being developed actively.

The industrial world still runs on Python 2.x; the appearance of 3.x is a reminder that the next generation is here, and this is the time that all of the lower-level infrastructure and frameworks should begin their porting work so that we'll all eventually migrate.

If you want to find out more about the relationships between Python 2, Python 3, and the changes/differences between the two as well as the timeline and migration, you can check out this online article I wrote earlier this year:

"Python 3: The Evolution of a Programming Language"
http://www.informit.com/articles/article.aspx?p=1328795

I also gave a talk on this same subject at PyCon 2010 in February. You can access the video and the slide preso here:
http://us.pycon.org/2010/conference/schedule/event/29/

wescpy
+1  A: 

There is ( are) actually a Django port to Py3k.

http://bitbucket.org/loewis/django-3k/

I can also remember quite good of having read a thread about a University project of porting Django to py3k, on the django-developers mailing-list, but I can't find the thread at the moment.

EDIT Oh here it is:

https://bitbucket.org/fiji/django-3k/

The project is lead by students at the University of Toronto. :-)

ENDEDIT

Querying for something like "Django py3k port" brings up some useful results.

Also look at these URLs:

Kenny M.
+2  A: 

CherryPy 3.2 (still being worked on) will run on Python 3.x

Bottle can also run on Python 3.x after using 2to3 on it. Easy to do and it does work. However, Bottle is not a 'complete framework' but it is easy to use.

Edit:

I have used Bottle in Python 3.1, stackless python 3.1 to be specific, for a game that I am slowly working on. But at work, I am just using Python 2.6 And soon I will be using Webpy.

The site I work on is in PHP, but when I need to add a new feature, that I can easily separate from all the PHP code, I will do it in python. Even though I work with PHP almost everyday and use Python only a few times a month, I still can get things done faster in Python than PHP :)

Echo