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
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.
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!
UPDATE 2011-2-27: I'd say that support for Python 3 is improving constantly and you might want to check and see if your project can't be done with Python 3. There's a website devoted to tracking support for Python 3: http://getpython3.net/
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.
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.
As of 2019, unless the project you're working with requires Python 2, the only reason you would learn about it is to understand the evolution of Python. That could give you some insight into programming language development. You can get a grasp on the differences by reading the Python 3.0 release notes and subsequent release notes or reading a more modern article about the differences.
However, you wouldn't use Python 2 to start a new project at this point, and trying to maintain support for it has become counterproductive. Python 2 will receive no official support after January 1, 2020; and many popular third party projects will drop support for it at that point.
Python is (as of this writing [2011-11-09]) more than 20 years old, and Guido and the community have learned a lot in those intervening years. Guido's original concept for Python 3 was to make changes to the language primarily to remove the warts that had grown in the preceding versions.
...
Because maintaining multiple versions of Python is a significant drag on the resources of the Python developers, and because the improvements to the language and libraries embodied in Python 3 are so important, it was decided to end the Python 2 lineage with Python 2.7.
→ PEP 404 -- Python 2.8 Un-release Schedule
Also see When did Python 3 become the obvious choice for new projects?
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.