Jump to content

To learn Python 3.x or Python 2.x

Zenettii's Photo
Posted Feb 14 2012 07:07 AM

In 2011, I started to learn Python, I began with 2.x just because thats what all the guides were covering, but because I'm new I've always wondered if I should have started at 3.x.

I'm comfortable enough with the basics of Python to write some real basic stuff, but as I aim to progress to intermediate level, I want to gain better understand of the modules I can import, learn GUI coding (wx seems to be enjoyed by plenty?) and look at some frameworks (web, networking etc) would I now be better off looking at 3.x?

I'm not really sure how much progress has been made moving frameworks and such over to 3.x, and concerned that I might get lost or confused trying to learn things which it turns out are not yet 3.x compatible.

On the other hand, I don't want to get too involvedi n 2.x only to find that I'm back to beginner stage again in 12 months because everyone jumped ship to 3.x This is my first language, and hopefully not my last.


0 Subscribe

1 Reply

+ 2
  mhalverson's Photo
Posted Feb 16 2012 11:43 AM

It is going to depend on what you want to do with it. I, myself, started with 3 as I don't really need much besides what is in the standard library. I haven't really tried to learn 2.

Many third-party modules are not yet moved over to the python 3 line, but most of the more popular ones are working on it. In some cases there are alternatives available as well - for instance cxFreeze instead of py2exe. wxWidgets are not available in python 3 yet, but the tkinter toolkit is part of the standard library and can make excellent GUIs (there shouldn't be anything you can do in one and not the other - some things may just be more work and done differently).

You shouldn't be at stage one when the change really happens anyways. There are significant and incompatible changes between the 2 and 3 lines (for example print is now a function and not a statement), but it is not a new language. Most of what you learn will apply, so you will be learning what has changed, not starting from scratch. Plus the change will not happen in 12 months. Probably it will take closer to 12 years before the 2.x line is really becoming extinct.

Many webservices are not offering python 3 yet, if you want to use it on servers, but some are.

If you are at point where you can really start to identify what sort of modules that you will want to use, start researching and see if they are ported to the 3.x line yet. Start looking at what alternatives may be available as well. If you can't do what you want with the 3.x line, then you will need to focus on 2.x now. If you can, then you have an option. If you continue to use the language, you will eventually need to learn 3.x.

You've made a good choice for a first language. I've worked with several languages, but since starting to work with python a couple of years ago, have really started to love it. I hate the fact that whitespace is meaningful - but that is about the only major problem that I have with it (and you NEVER have a program fail because you forgot a semicolon!).