tags:

views:

344

answers:

9

I'm planning on learning Python, and I have a copy of O'Reilly Learning Python 3rd Ed. which covers Python 2.5. However, I seem to remember reading that Python 3 introduced fairly significant changes. Would it be in my best interest then to start out with a book that covers Python 3?

Related

+3  A: 

Python 2.x will be around for a long time still, since it's not compatible with 3 out-of-the-box.

The module ecosystem for 2.x is also currently much larger than 3.x's, so you'll probably be more productive with 2.x.

AKX
A: 

Not that Python is known for being speedy, but if you are doing anything performance intensive, Python 3 is roughly 10% slower. I expect it to get faster soon, as they optimize it more.

Zifre
+5  A: 

Bottom line: Python 2 will do you just fine. Feel free to start there.

Electrons_Ahoy
+4  A: 

Even though there are backwards-incompatible changes between python 2 and python 3, they're not that much different.

I'd say it's fine to learn either one, and then catch up on the differences when you want/need to learn the other.

CAdaker
A: 

If you are planning on using any of the more popular python libraries and frameworks for your projects (and there's very high probability you will be if you find python is a language for you) you should go with 2.x.

Also most existing installations of python are 2.x.

There's not a huge difference between 2.x and 3, it's just that some of the differences break backwards compatibility. So, it'll be easy to pick up 3.x once you know 2.x.

Vasil
A: 

Just in case all the other answers haven't convinced you, here is one more vote :)

Although Python 3 is the hype now, it is still a long way from the support in terms of libraries (modules) which Python 2 has. I would start with python 2.5 then gradually move to 2.6 which is a kind of step between. Note also, that they are not all that different, but the version 2 has a lot of background support for now.

ldigas
A: 

If you don't need all the extra libraries (GUI for example) go for Python 3. The main point is that much of the old stuff was removed and the language is much cleaner now. It's just more fun to program in Python 3 than in 2.

You can learn Python 3 just fine with your book, there are some changes, like the print() function, but most of it is compatible.

Georg
+2  A: 

This excerpt from the preface in "O'Reilly Learning Python - 3rd Edition" (page xxix) should set your mind at ease:

"In addition, discussions of anticipated changes in the upcoming Python 3.0 release have been incorporated where appropriate."

I highly recommend this book as an introduction to Python. As others have said, the transition from 2.x to 3 will not be too difficult, but this text's coverage of Python 3 changes will make your transition (when the time comes) even easier.

A: 

I probably wouldn't start with 2.5, 2.6 is is similar enough to 2.5 as it is. Especially if you're just learning as it's unlikely you'd hit anything that was a really significant difference. If you're gonna learn anything like Django or TurboGears.

The Py3 code is just cleaner, eg. the print statement feels far more natural. However cleaner isn't much use if your choice of library is still quite sparse.

We're doing some major Python training where I work, and the thought of starting people in 3 was dismissed pretty early on, but our dependencies are TurboGears & Django, so that colours our decision.

dochead