Python 2.x or 3.x for learning programming?

mrkun

Platinum Member
Jul 17, 2005
2,177
0
0
I recently started working in the software industry in a non-programming role, but I'd like to start learning again for my own knowledge/purposes. In college, I took a quarter of C and a quarter of C++ (that was CS 1 and 2 at my school), but that was a good 5 years ago and I don't really remember much of it. I had no plans to work in software, so I didn't see much benefit to continuing at the time; but now here I am.

I've decided to learn Python after reading online and a guy at my work recommending it, but I'm not sure which version to go with. My long term goal would be to write some tools that can query a MySQL database, parse the data, do some conditional stuff, and then write to a CSV/XLS file. I'm on a Mac with Lion if that makes any difference.

Thoughts?
 

velvetpants

Member
Aug 29, 2009
72
0
0
3.x is strictly better.
How is it better?

OP it doesn't really matter which one you start with. You can learn either version and you'll be able to code in both without much trouble.
The differences, on the surface, are very trivial. Often you can even run python 2.7 code in the python 3 interpreter without making any changes.

I would say start with 2.7 as it's much more widely used still and isn't going anywhere.
If you start with 3, you'll be spending a lot of time adapting the 2.# material to python 3, which can get confusing for a beginner programmer. After you've become proficient with python 2, you'll pick up the differences in python 3 in no time.
Also you'll have access to many year's worth of existing code libraries written in python 2.#.

Check this book out http://learnpythonthehardway.org/ and have fun.