views:

1253

answers:

11

The "what's new" list looks pretty extensive. I've heard that this is considered a radical shift in the language. Any early adopters out there? Would you advise someone dipping their toes into the water to stick with version 2.x? Or dive into 3.0?

+4  A: 

if you're just starting, by all means go with python3.0
libraries and modules will be ported in time, but you'll get cleaner syntax, better unicode support and won't need to re-learn anything later on. it is a backward-incompatible release for a reason, don't look back.

SilentGhost
I am just starting to learn python, but I want to use django, and from all indications I need 2.5/6 for that. Is that right?
Paolo Bergantino
yes, django requires python 2.3 to 2.6 version
SilentGhost
That right there is a good enough reason to stick to 2.6 in my book.
Paolo Bergantino
Yes, Py3k is great, but many vital 3rd-party libraries haven't been ported, yet (PIL, Django, wxPython…). Far better, at this point, to import from `__future__` and `future_builtins` and write 3.0-*aware* code in 2.6.
Ben Blank
@Ben: many beginners don't need all this libraries, but the time they'll come to attention they even may be ported.
SilentGhost
+20  A: 

It's not really a radical change, unless you count a change to the syntax of the print statement as radical. It's not much more than another step the evolution of Python, but they finally took the chance to make all those minor changes that make the language incompatible with previous versions. All that means is that you can't write a script that runs on both Python 2.x and Python 3.x.

For learning the language, there's little reason to stick with 2.x. You can even use tutorials designed for version 2.x with Python 3.x, as long as you understand where the differences are. Third party addon module support will come in time. That means if you're wanting to immediately jump in with Django or some existing framework, you will need to stick with 2.x until Django updates too.

Greg Hewgill
i'd imagine that very simple code for py3k will run on 2.x all right
SilentGhost
Thanks to all for the insight. The Django nugget will keep me at 2.x, so thank you for reminding me of it.
duffymo
@SilentGhost - no. E.g. print("fatal error", file=sys.stderr)
Alabaster Codify
@Alabaster: that's not simple. print('Hello world') works. as do many other things.
SilentGhost
If you want code that will run in both, use e.g.: sys.stderr.write("fatal error\n")
Ryan Ginstrom
Theres one big reason to avoid Python 3, even if you are only learning the language: support of third party libraries which you want or need to use. This is the only reason I'm still using 2.x (I use 2.6, but not all libraries support it yet either, so occasionally I need to use 2.5)
Dan
Yeah, I would disagree with "for learning the language, there's little reason to stick with 2.x". If you're learning the language just for education or nebulous future possibilities, learn 3. If you're learning it to get something done within the next year, you should probably learn 2.x.
Carl Meyer
I'm still using Python 2.x for `wxPython` and `matplotlib` support, which is absent in Python 3.x.
Kit
+30  A: 

Speaking as a relative newcomer to Python, I would recommend starting with Python 2.6, for two reasons. First, many useful, third-party libraries have not yet ported and likely won't be for a few months. Secondly, the upgrade path from 2.6 to 3.0 has been designed to be relatively gentle, with a -3 compatibility flag to indicate incompatible code and a 2to3 migration utility.

There are far more Python 2.x resources out there than 3.x. Once you've got a good handle on 2.6, moving to 3.0 won't be painful.

Edit: quoting Guido van Rossum from July 2007: "Definitely learn Python 2.x ... I expect it'll be two years before you'll need to learn Python 3.0, and the differences aren't that great from a beginner's perspective: most of what you'll learn about 2.x will still hold about 3.0."

Cal Jacobson
so two years will be come July
SilentGhost
True, though I wouldn't hold him strictly to 24 months. I included the quote since if the Python BDFL tells you that 2.x is the way to go, that's probably the route you should take.
Cal Jacobson
+1 for saying exactly what I was going to say.
Dan
@Cal Jacobson: RANTAGE!!!!!!!! Where have you been?
George Stocker
@Gortok: writing Python, of course!
Cal Jacobson
Writing Python? thought you were into PHP now?
George Stocker
That, too. More tools for the toolbox...
Cal Jacobson
+1  A: 

It was the jump to 3.0 that really got my interest in Python piqued. There's a lot of goodness in the new spec.

If you're just looking to dip your toes in, I'd definitely start with what's current. By the time you're up to speed, the major scripts and libraries should have been ported and ready to use.

Jekke
+1  A: 

Some people may be reticent to switch to 3.0 due to the considerable amount of changes implicated. Not every code written with previous versions of Python is compatible with 3.0 so individuals/businesses have to invest time and efforts if they want to make the switch.

However, if you're up to a fresh start then yes, go with 3.0, you'll have to make the switch someday anyway.

turbovince
+3  A: 

I've dabbled in it, but everything I write depends on at least one, and usually several, 3rd party modules. 3rd-party support is, expectedly, still pretty weak for Python 3.0.

So, if you're just getting started to learn Python - jump to Python 3. If you're trying to build an application that might need a 3rd party library at some point, I'd stick with Python 2.5 (not even 2.6 yet).

Triptych
Agreed: still on 2.5 here.
Adam Bernier
A: 

I am still using 2.5.2 version on my linux box.

+5  A: 

I haven't used python in years, and I only just read up on 3 because of this post. I find I like the new changes, but that's probably because I don't have anything invested in the old version at the moment. Many just seem like logical progressions of the language; python has progressed in this manner since its inception.

One thing that particularly stood out for me was the new string formatting options. They're still keeping the old c-style ("%") escaping (they'll deprecate that for Python 3.1) but they're adding a .NET style formatting ("{0}") escaping.

The thing is, they're taking the .NET style formatting in a totally new direction, which I very much like. Here are some examples...

Format is a non-static method of string:

"Hello {0}!".format("World")                   # "Hello World!"

Named formatters:

"Hello {name}!".format(name="World")           # "Hello World!"

Complex formatter types:

"Hello {0.worldField}".format(myWorldObject)   # "Hello World!"
Randolpho
`format` has been backported to 2.6, and is a joy to use :)
voyager
+3  A: 

I'm using 3.0 and it's been alright.

It was a pain to change my code to fit the 3.0 specs for urllib, but other than that, no problems.

Onion-Knight
A: 

I recently tried to start the migration to 2.6 with the end goal obviously being to make it to 3.0 down the road. In less than a few hours I realized I'll be sticking with 2.5.X for a while since many of the third party modules/libraries aren't on 2.6.

I bring this up because learners of the language will want to write 'fun' stuff using examples from various resources and those resources often will use add-ons from the community that simply aren't there for 2.6+ yet. Some haven't even decided what they are going to do with 2.6+ vs. 3.0, much less actually worked on the transition.

A: 

The general trend seems to be everyone learning 2.6, because (iirc) it takes syntax that would generate errors in 3.0 and sends out warnings, which teaches you to start changing towards that sort of idea.

Andrew Szeto