Python Version

Russ

[H]ard|Gawd
Joined
Apr 14, 2005
Messages
1,875
So I haven't had a class involving Python in a semester, and after my latest reformat when I stopped on by their website, they've gone and released a new version!

Obviously the folks at python.org are going to be a little biased, so I'd like to get [H]'s opinion. Which version of Python should I install?

3.X is not being considered, I haven't had a single professor use 3.X, and every one of them has warned me away from it due to both compatibility/legacy code issues and that it isn't really the same language any more (first and foremost I think Python should be a "rapid prototyping" language).

I've used 2.6 for the last year or so, but my question is mainly about this 2.7 release. The changelog on python.org is making me wary of using it though, specifically because it says "this release contains many of the features that were first released in Python 3.1." Well, aren't those features the ones that made people stick with 2.X for so long after the "new" version came out? Do I want them?

That's my question, have you used Python 2.7, and if so, is anything broken that used to work in 2.6 (due to these "3.1 features" that were added)?
 
I use both Python 2.6 and Python 2.7 at work. Python 2.7 is compatible with anything that is 2.6 compatible. Some stuff has been backported into 2.7 from 3.x, but core stuff will behave as you expect it would in 2.6.

Python 3 is vastly different from Python 2.x - print is now a real function and requires parentheses, for one thing. Some common modules now have different behaviors. And there are more changes that basically make Python 3 a new language.

Many popular libraries/frameworks are not currently Python3 compatible, which is a big reason why many still use and recommend 2.x. Off the top of my head, django and python-twisted are two such frameworks.
 
2.7 should be fully backwards compatible. The 3.1 stuff that was added isn't breaking old stuff to my knowledge.

If you look at http://docs.python.org/dev/whatsnew/2.7.html#python-3-1-features its just new features, not changing existing functionality (for the most part). I suppose if you relied on the repr of a float in a weird way it could break things.

We upgraded 2.6 to 2.7 at work and it runs just fine.
 
You're probably not going to notice any differences between 2.6 and 2.7. If you only learned it in a class, you probably wouldn't notice the difference between 2.2 and 2.6, either - there's been a lot of changes, most of them minor modifications to the standard library & the addition of syntactic sugar and a few new types (list/dict comprehensions, generator expressions, sets, relative imports...). The actual core language hasn't changed much at all.

Jumping to 3.x, OTOH, might bring some things out that change your world - it really depends on how deep into the language you are.
 
Back
Top