views:

647

answers:

8

Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I am leaning towards 3.0 since I will be programming applications more for personal/learning use, but I wanted to see if there were any good arguments against it before I began.

+3  A: 

I think that you will be better served going straight into 3.0. Unless you have a legacy codebase to contend with, there are very few advantages to learning the 2.xx ways of doing things.

In the Python world (as in most others, really), releases do tend to take a while to migrate down to all of the subprojects, but if you ever find the need to transition back to 2.xx, I don't think you'll find relearning things to be particularly painful.

jsight
The thing is, it works better in the other direction. Start with 2.6, then when 3.x has better third party support and so on, it will be easy to migrate to it. And there won't be much more to learn, since 2.6 has 3.x features backported to it.
Wahnfrieden
A: 

Use python 3.1, Luke.

Maxim Kim
Why though? -1.
Wahnfrieden
More people using py3.x => faster lib ports.I don't care about -+1.
Maxim Kim
That's rather impractical and unhelpful for this question.
Wahnfrieden
If I were the person who asked the question I would find out that there is python 3.1 available. So I do not have to choose between 2.x and 3.0. Anyway that is pretty obvious -- if you can use py3k use it.
Maxim Kim
"if you can use py3k use it." Stunning insight.
Wahnfrieden
+15  A: 

Absolutely not 3.0 - 3.1 is out and is stabler, better, faster in every respect; it makes absolutely no sense to start with 3.0 at this time, if you want to take up the 3 series it should on all accounts be 3.1.

As for 2.6 vs 3.1, 3.1 is a better language (especially because some cruft was removed that had accumulated over the years but has to stay in 2.* for backwards compatibility) but all the rest of the ecosystem (from extensions to tools, from books to collective knowledge) is still very much in favor of 2.6 -- if you don't care about being able to use (e.g.) certain GUIs or scientific extensions, deploy on App Engine, script Windows with COM, have a spiffy third party IDE, and so on, 3.1 is advisable, but if you care about such things, still 2.* for now.

Alex Martelli
So sad that I can't find Python 3.1 in Ubuntu repository.
Selinap
Then get it from python.org
Evan Fosmark
Far more libraries than GUI, scientific etc. still only support 2.6.
Wahnfrieden
+2  A: 

You should go with the latest release of any programming language you learn unless you have a specific reason not to. Since you don't have an existing project that won't work with Python 3.0, you should feel free to use the newest version.

Bill the Lizard
-1. Bad, shortsighted advice: "You should go with the latest release of any programming language" - things are much more nuanced than this. Also, latest what release? Stable release?
Wahnfrieden
"...unless you have a specific reason not to." Don't just quote part of a sentence and tell me I'm wrong. Take the whole thing in context. Yes, the latest stable release.
Bill the Lizard
It's still misguided advice. He doesn't have a specific reason not to, that's why he's asking - but I can give him a few.
Wahnfrieden
Since the OP is specifically asking for arguments against 3.0, maybe you should give him those reasons instead of just vaguely alluding to them.
Bill the Lizard
The argument against it is that there's not a great enough benefit from using it yet that makes up for the inability to make use of most things outside the standard library, especially considering the jump from 2.6 to 3.1 is a small one. And I think that's enough.
Wahnfrieden
There is a specific reason not to: There is almost no libraries. This will hopefully be rectified soon, but that's a very big specific reason.
Lennart Regebro
+3  A: 

Python 3.1 should not be used until other libraries have caught up with support for it.

You should use 2.6 now. It has several 3.x features back-ported to it, so that migrating to 3.x won't be difficult later on, and you won't learn obsolete practices.

Wahnfrieden
Will you really depend on the third party library?
Selinap
It's rather common. Learning Python is as much about learning the API as it is the 'language' itself - and why avoid useful extensions to the API?
Wahnfrieden
Besides, once he learns it and wants to do something with it, I doubt it will be long enough from now for good third party library support - at least a couple years.
Wahnfrieden
+1  A: 

The good news is that it's not really that tough to learn both Python 2.x and 3.x. You can install the latest 2.x version as the version registered with the system to run Python scripts by default, but also install the latest 3.x version to explicitly kick off when you want to. That's what I have on my Windows Vista system.

Then, the key document for learning the differences between the 2.x and 3.x versions is:

http://docs.python.org/3.1/whatsnew/3.0.html

If you read Python learning materials out there which are based on 2.x and also refer to that "What’s New In Python 3.0" link above, you'll get an understanding of how things changed. Also see the other whats new docs, like for the differences between 3.0 and 3.1, but the link above is the main one to understand the 2.x vs. 3.x changes.

Anon
+7  A: 

Short answer: Start with Python 2.6.

Why: Programming is more fun and useful when you can leverage the work of others. This means using 3rd party libraries often. Many of the popular libraries for Python don't have 3.x support yet. PIL and NumPy/SciPy come to mind. My favorite interpreter, ipython, also doesn't work with 3.0 yet. Many unit testing frameworks and web frameworks are also not on 3.0 yet.

So if you start out in 3.x many doors will be closed to you, at least until 3.x porting takes on steam. There are admittedly a lot of nice features in Python 3.x, but some of them have been backported to 2.6 and some more will make it into 2.7. So stick with 2.6 for now, and re-evaluate 3.x in a year's time or so.

Anton I. Sipos
+3  A: 

Use 3.1

Why?

1) Because as long as everyone is still using 2.6, the libraries will have less reasons to migrate to 3.1. As long as those libraries are not ported to 3.1, you are stuck with the choice of either not using the strengths of 3.1, or only doing the jobs half way by using the hackish solution of using a back-ported feature set. Be a forward thinker and help push Python forward.

2) If you learn and use 3.1 now, you wont have to relearn it later when the mass port is complete. I know some people say you wont have to learn much, but why learn the old crap at all? Python itself is moving towards 3.1, the libraries will move toward 3.1, and it sucks to have to play catch-up and relearn a language you are already using.

3) 3.1 is all around a better language, more stable and more consistent than 2.6... this is normal. The lessons learned from 2.6 were all poured into 3.1 to make it better. It is a process called PROGRESS. This is why nobody still uses Windows 3.1. It is the way things move FORWARD. Why else do you think they went to the trouble of back porting a feature set in the first place?

4) If you are learning Python, and learn 2.6, then by the time you are really comfortable with the language, the ports will be out, and you will have to learn the libraries, and the language all over again. If you start with 3.1, then by the time you are comfortable with the language, the ports will be out, and then you can learn the libraries that you are interested in. It is a smoother process.

5) To be a better developer. If you have to learn and relearn the same things, your understanding will not be very deep. By learning this language, and its libraries only once, you will have more time to work with them rather than relearning syntax. This allows you to understand them better. If you are really missing some pieces by forgoing on the libraries? WRITE THEM. You will probably not need an entire library, and can usually write only those pieces that you need, and develop tools for yourself. This, again, helps you understand the language better, and more deeply.

Steve