After following the reading suggestions, I soon found myself looking at quite a few code examples that would only run under a particular version of python. Finally, I converted the example that I was working on to run under Python3. I just wondered if you guys would advise a newbie like me to concentrate on Python3 or stay with Python2 and get into bad habits when it comes to change eventually? Apart from the print and input functions, I haven't so far got a lot to re-learn.
Kind regards, Barry. Barry, If you're just starting out, go with 3.x. If you have a need for some third party modules that aren't yet available for 3.x, you'll have to stick with 2.x. Most beginner tutorials will work without changes, except for the print statement is now a function, e.g: print "foo" Is now: print("foo") There isn't a whole lot of difference in syntax to learn. Some modules have been renamed, some module functions re-worked, etc. Probably the biggest change is the move to all unicode strings. One thing you can do if you're running 2.x but want to get into the 3.x swing of things is turn on 3.x warnings. It will tell you if you did something the 2to3 tool can't automatically fix: python2.6 -3 If you want, you can actually use the 3.x style print function and true division when using 2.x by putting this at the top of your code:: from __future__ import print_function from __future__ import division Now in 2.x, just like 3.x this will raise an exception: print "foo" #<-- Now fails in 2.x print("foo") #<-- Works. -Modulok- _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor