Re: breeds of Python .....
S.Irfan Rizvi <s.irfan.rizvi5 <at> gmail.com>
2012-04-01 03:58:08 GMT
please remove me from here
On Sat, Mar 31, 2012 at 4:28 PM, Modulok <modulok <at> gmail.com> wrote:
> 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
> Kind regards, 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:
> 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.
> Tutor maillist - Tutor <at> python.org
> To unsubscribe or change subscription options:
~ S. Irfan Rizvi
Tutor maillist - Tutor <at> python.org
To unsubscribe or change subscription options: