Question

Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.

I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge)

a 2.x tutorial is probably more useful now, but it would be nice to start producing 3.0 tutorials.

anyone have thoughts?

(of course I could do both, but I would prefer to do one or the other)

Was it helpful?

Solution

Start with 2.x. Most existing libraries will be on 2.x for a long time. Last year, Guido himself said that it would be "two years" until you needed to learn 3.0; there's still another year left. Personally, I think it will be longer. People writing code on 2.x can learn how to use the 2to3 tool and have code that works on both versions. There is no 3to2, so code written for python 3 is significantly less valuable.

Thats not to mention how disappointing it will be for your students to learn that python 3 is not installed on their Linux computer ("/usr/bin/python" will be python 2.x for the next 5 years, at least), that there is no django for python 3, no wxwindows for python 3, no GTK for python 3, no Twisted for python 3, no PIL for python 3... the real strength of Python has always been in its extensive collection of libraries, and there are very few libraries for python 3 right now.

If your tutorial is well written, you should easily be able to update it to python 2.6, 2.7, and eventually python 3.

OTHER TIPS

Van Rossum (creator of python) explains that "if you're starting a brand new thing, you should use 3.0." So most people looking to get started should even START with 3.0. It will be useful especially since there are probably very few out there now.

the article

Learn Python 3.0, as contagious suggests.

Python 2.x is not very different, there seems to be a great deal of FUD about the rather minor differences between them. Sure, the differences are great enough that most programs will need to be modified, but almost all of the modifications are straightforward (like changing print statement to print function).

In fact, Python 2.6 can optionally enable all the new syntactic features of Python 3.0. It's a very well-thought-out transition process.

Python 2.x has been out long enough to build up quite a few tutorials already, but 3k has much less resources available. Some intro level 3k stuff would probably see more general purpose use. So unless you're tailoring this to a specific sub domain that lacks any python resources, 3k would be of greater use.

It depends on your audience. If it's a general audience, and you plan to leave it posted for a long time, I'd suggest looking forward and going with 3.0. On the other hand if it's for a project or group that's going to be doing work in the near future, Python 2 probably make more sense.

The differences are small enough that it's really not going to matter much.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top