Selasa, 04 Januari 2011

What Should I Choose...Python 2 or Python 3 ?


At the time of writing (June 24, 2010), both are still under development. There’s at least one more 2.x release planned (2.7), but the 2.x branch probably won’t see any new major releases after that. 3.x is under active and continued development.
3.x is the newest branch of Python. People decided to clean up Python 2.x properly, with less regard for backwards compatibility than new releases in the 2.x range. Nick Efford has a nice writeup about why you might like Python 3.x as a language here: http://www.comp.leeds.ac.uk/nde/papers/teachpy3.html
Python has amassed a pretty big amount of quality software over the years. The downside of breaking backwards compatibility in 3.x is that a lot of that software doesn’t work on 3.x (yet).

If you can do exactly what you want with Python 3.x, great! There’s a few downsides, such as library support and current Linux distributions and Macs still shipping with 2.x by default, but as a language Python 3.x is definitely ready. As long as actually getting Python 3.x on your user’s computers (which ought to be easy since a lot of people reading this might only be developing something for themselves) and you’re writing things where lack of third party software isn’t a major impediment, Python 3.x is an excellent choice.

Most of the current #python regulars will recommend Python 2.x because a lot of libraries that make your life easier only work on 2.x so far. Popular ones include Twisted (for networking and a bunch of other stuff), gevent (like Twisted but different), Django (for building websites), PyGTK (for making GUIs), py2exe (for packaging your application for Windows users), PIL (for processing images), numpy (for number crunching)...

One of the problems with picking 3.x stuff is that most of the #python regulars are professional 2.x developers, so we might not be able to help as effectively with questions about new 3.x software as opposed to existing 2.x software such as Twisted, PIL or PyGTK.


To make the Python 3.x vs 2.x situation better is by porting an existing library and making future users happy. Porting isn’t always easy, but it’s usually easier than writing your own thing from scratch. Existing project members will love you, because porting often finds bugs in the original software, improving the quality of both the original and the 3.x port.
How you’re supposed to do porting is explained in PEP3000: http://www.python.org/dev/peps/pep-3000/#id9

Don't worry when you write something in 3.x and someone wants to use it who only have 2.x. There's a 3to2-tool (http://pypi.python.org/pypi/3to2/), which tries its best to convert 3.x code back to 2.x code.

You can download new release of Python in this link (http://www.python.org/download/).


Other resources that may help make the choice between Python 2 and Python 3 : 

So it's up to you to choose....

Tidak ada komentar: