I'm starting a new Python web project. With most frameworks, everyone rushes to the latest version, however, it seems that this is not as true for Python 3.x.
Which version of Python should brand new projects use?
I'm starting a new Python web project. With most frameworks, everyone rushes to the latest version, however, it seems that this is not as true for Python 3.x.
Which version of Python should brand new projects use?
I use 2.5 for Google App Engine projects and 2.6 for my Django projects.
A lot of 3rd party Python modules still require Python 2.x (numpy, scipy for example). If you will use any of those, or if you don't yet know what modules you need and want to keep your options open then stick with Python 2.x for now.
If you know that all the modules you need work with Python 3.x then go with that.
for a web project, chose the python version that is supported by your hosting provider.
if you are lucky to have a dedicated server, then chose whatever version is best supported by the framework you chose. python 3 is still not supported by the major web framework, so python 2.6 seems the best choice.
if your project is hosted on a shared host, you will have to stick with the python version installed on the host (personally, i am stuck with python 2.4.4, hoping my hosting provider will upgrade to 2.5 or 2.6, which will not come anytime soon)
I'd recommend Python 2.6 because it has some features of Python 3.x, but it still retains the same functionality found in Python 2.5. While some might argue that Python 3.x is better (quite possibly because of the immense amount of reorganisation and the fact that all strings are Unicode by default), most Python code in use right now is still for Python 2.x. I'd say stick with Python 2.6 until you need Python 3.x. :)
Python 3 is a great place to start for those "with no baggage" (meaning no existing Python code or apps, no libraries/dependencies that haven't been ported to Python 3 yet, etc.).
However on the other hand, although Python 3 is here, most of the industrial world still runs on Python 2, so if you do need to create an app to run today using the libraries and packages available to you, that's where you should start. If you do, use any release 2.6 or newer as they have features backported from 3.x to help you start thinking in a 3.x kind of way. :-) If you learn one, it's easy to adapt to the other (and vice versa).
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.
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. So, like the others, I would suggest you start with any Python 2.x.
On a related note, I had the publishers add two new appendices (C & D) to the latest printing (5th!!) of my book, Core Python Programming, one on Python 3.x and the other on the importance of 2.6 and the role it plays in helping users to transition to Python 3.
Finally, I've been giving talks on Python 3 and covering the main differences from Python 2. Here's one that I gave a PyCon a few months ago which includes the slide preso.