tags:

views:

940

answers:

7

I am about to learn Python and was wondering what is recommended, learning python 2.6 or 3.1? (any tips on learning python is welcomed as well =)


edit: Is the difference really big between the two? If I learn python 2 will i have trouble learning python 3?

+5  A: 

You really want to stick with the later version. Python 2.6 and the rest of the 2.x versions that come out are really for compatibility. However, this is not true if you want to use a framework like Django right away because it is incompatible with the 3.x series at the moment.

A tip for learning Python? Just start using it and find online documentation for it. I feel it's an easy (and awesome) language to pick up.

AlbertoPL
That's just not true. python.org website itself recommends the 2.6 version. If you look at the download page, it says "If you don't know which version to use, start with Python 2.6.3"
nosklo
What does it matter what they recommend? The point is it's being asked here, and thus can get more information about which one to use so they don't have to blindly follow that advice.
AlbertoPL
Your statement "Python 2.6 and the rest of the 2.x versions that come out are really for compatibility" is incorrect. This is shown by the fact that 2.6 is the officially recommended version to use.
Lennart Regebro
How does that make the statement incorrect? The statement could be correct and still be the officially recommended version to use. They are in no way contradictory of each other.
AlbertoPL
It's pretty self-evident that they are contradictory. I'm sorry AlbertoPL, you are simply wrong on this issue.
Lennart Regebro
No, it is not self-evident. It's officially recommended due to the amount of compatibility there is with other existing code bases and of course documentation. The Python developers are releasing 2.x versions alongside the 3.x versions. So please tell me how 2.6 being recommended contradicts the purpose of future 2.x versions being for compatibility's sake?
AlbertoPL
The statement you made was to use 3.1, because 2.6 is only for compatibility. This is very different from the recommendation to use 2.6, because 3.1 does not have enough support yet. These statements are self-evidently contradictory.
Lennart Regebro
I don't see the problem with going ahead and just learning 3.1, since he's talking about learning the language and not using it as a solution. Anything basic he'll need for homework will probably not be impacted by support of other frameworks and libraries.
AlbertoPL
It's not a problem per se. But since he can't actually use it, it's better to go with 2.6. Because with 2.6 he can both learn *and* use. So it's not a problem to use 3.1, it's just better to use 2.6.
Lennart Regebro
+4  A: 

If you're looking to learn python: http://diveintopython3.org/ was recently finished and can be read completely free online or you can buy the hardcopy. It's a great tutorial and introduction to the language.

Clint
+9  A: 

I would go with 2.6 for a couple of reasons.

  1. There's so much more material (books, examples, etc) based on 2.6. Some things might not work under 3.x, and you'll be able to get some good second-hand deals on 2.4-6 books.

  2. The majority of libraries you'll want to pull in are still aimed at 2.6. This will change in time, but 2.6 support won't vanish overnight. Far from it. Linux distributions (that have a lot tied into python) aren't planning to move on for at least another year, so you're safe!

Oli
A: 

If you want to use existing libraries and modules written in C/C++ or use SWIG, you'll have to use python2, otherwise I don't really see a reason to stick with python2.

tstenner
+13  A: 
  • If you're looking to develop software right now stick with Python 2.6.
  • If you're looking to learn the language and experiment go with Python 3.1.

Python 3.1 doesn't have the same library support (yet!) as Python 2.6, so you'll encounter difficulties working with existing software projects. If you're not pressed to produce a working product at this very moment, I'd suggest trying out Python 3.1. And there is no better place to start than Dive Into Python 3, as has been mentioned by Clint. Good luck!

ariddell
I just plan on doing homework and maybe experimenting in python. So I guess I'll be rolling python 3
Not necessarily. If you do any natural language processing homework, the NLTK isn't ported to Python 3 yet.
Calyth
It's August, 2010 -- is this still true or has library support improved for 3.1?
Casey
+5  A: 

You would want to go with 2.6 today.

Why? Because there is no library support for 3.1. We've just finished porting setuptools (under the name Distribute) to Python 3, so hopefully library support for Python 3 will increase dramatically during the next year, but it's not there yet.

And it's not so hard to switch. It's not like it's a whole new language, like some Python critics make it sound like. So if you start with Python 3, it's no disaster either. It's just that it's going to be hard to actually be productive in Python 3 at the moment. So go with 2.6.

Lennart Regebro
A: 

As for tips on learning Python, I would work through the main tutorial (http://docs.python.org/3.1/tutorial/) and then explore the Beginner's Guide. O'Reilly's Learning Python is pretty handy if you prefer using a book.