Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

The version of python which I am using is 2.6, and there is a 2.7 and 3.x. Usually I use python for some trivial program/snippet. I realize there are some major difference between 2.x and 3.x. I would really like to know, if I am going to make a bigger project with python, which version of python should I use?

Should I upgrade to 2.7, or go to 3.x or stay with 2.6?

The decision should be based on these terms:

  1. Number of user in the internet as a community. More users mean more open-source package and help from them.

  2. Functionality.

  3. Support from official development team.

  4. Compatibility for existing module/package.

Thanks!

share|improve this question
5  
Can someone point out any beneficial changes made by python 3.x? –  lamwaiman1988 Aug 23 '11 at 4:39
1  
You mention that you know that compatibility with existing modules is an issue, but you don't tell us what existing modules your code relies on. This question is pretty much unanswerable. –  Wooble Aug 23 '11 at 11:36
2  
off topic; recommendations AND gorilla vs shark in one question wow! –  Jarrod Roberson Jul 15 '12 at 8:05
3  
This question and it's answers will only be useful for a small window of time. What makes sense now might not make much sense a year from now as 3.x becomes more mature. –  Bryan Oakley Aug 21 '12 at 16:37
add comment

closed as off topic by ChrisF Feb 27 '13 at 23:00

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

7 Answers

up vote 24 down vote accepted

I would suggest Python 2.7 myself. It's the latest release in the Python 2.x series. Most of the Python modules are made to work with the Python 2.x. There is a movement to try and move to Python 3, but any of the Python 3 modules are written for both 2 and 3. Remember to not use old features which are not available in Python 3, so that you can just 2to3 your code to make it run on Python 3.

If you go with Python 3, you're one of the early adopters and you will likely have to tell others to download Python 3 (a lot of computers will just have Python 2). On the other hand, new features are only going to come to Python 3. Python 2 is permanently in maintenence. So I would not suggest still using Python 2 in 10 years.

If you want to keep an eye on Python packages and their compatibility with Python 3, you can keep an eye on this site: http://python3wos.appspot.com/

share|improve this answer
    
django doesn't support 3.x? So user familiar with django just can't use 3.x? –  lamwaiman1988 Aug 23 '11 at 4:13
    
hey normally when a new version gets released it means it is better then the earlier one. And why python is getting released in 2.x series and another in 3.x series? What is the actual difference in them. –  Ashin k n Aug 23 '11 at 4:31
4  
Python 3 made some changes to the language that are beneficial, but they are not backwards compatible with some of the features in Python 2. So some things were removed and some added (and the removed things make them not compatible). –  jsternberg Aug 23 '11 at 4:35
    
+1 for 2.7, best ratio of compatibility (at least for the libraries I use) until 3 is more widespread –  wildpeaks Jul 15 '12 at 10:22
    
@Ashinkn The changes can be found here docs.python.org/3.0/whatsnew/3.0.html. The major compatibility-breaking change being the switch from using Unicode (as opposed to ASCII) as the default string type. Where people used strings as byte[] before there is a new bytearray type that is used instead. Also, any 2x strings explicitly defined as unicode need to be changed to regular strings. –  Evan Plaice Feb 27 '13 at 20:31
add comment

Django now "experimentally" supports Python 3.2+ as you can see from their posts here.

Given that, and the fact that Python 3.x is the future of the language, I would say Python 3 is best now.

share|improve this answer
add comment

Until a bridge is developed intrinsically within 3.x to allow the transparent use of 2.7 packages a move is fraught with peril because the language is really all about what has been contributed to it. Formal considerations and purity are negligible in comparison. Such a transparent bridge isn't likely to happen out of sheer pedantic stubbornness and disregard for the user base.

share|improve this answer
    
Such a transparent bridge is unattainable. The 2to3 and six packages provide ample bridging, but are far from transparent. –  Martijn Pieters Nov 24 '12 at 11:35
add comment

I was in the same boat previously and this is what I found. Python 2.6, 2.7, and 3.2 can be installed side-by-side using MacPorts and can easily be switched. (I am a Mac user). Look for alternatives to Macports for your platform.

share|improve this answer
add comment

It doesn't really matter whether you use Python 2.7 or Python 3 If you do not use old features in Python 2.7, you can just 2to3 your code to make it run on Python 3.

share|improve this answer
add comment

For each project check if all libraries required for a project already got 3.x python support then use python 3.x because it's future and that's last official stable version.

Else use whatever you need to use for library compatibility.

share|improve this answer
add comment

My opinion is we need to start getting people over to Python 3 and if there are libraries that are not compatible with Python 3, we need to start making that not the case.

Python 3 is the future of the language, and the more code we write using it, the better.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.