[Tutor] The Perennial 3.2 vs 2.7
Wayne Werner
waynejwerner at gmail.com
Fri Nov 18 03:41:56 CET 2011
On Nov 17, 2011 8:28 PM, "Mark Lybrand" <mlybrand at gmail.com> wrote:
>
> Okay, so I am about to take up the banner of learning Python again. I had
started with 3.2 and I have a book that I like. But all of the things that
I want to use Python for appear to be 2.x specific. Will I be setting
myself up for failure if I continue learning 3 and then try to write
programs in 2.x? Note that I am an experienced programmer, albeit in
curly-brace languages (Perl, Java, C#, HTML/CSS/JavaScript), so that will
probably count in my favor. But y'all would know better than I if there
are significant issues that I will need to overcome conceptually.
The main differences are syntactic. If you add these lines to the top of
your 2.7 files then you won't have much else to worry about.
from __future__ import print_function, unicode_literals, division,
absolute_import
range, input = xrange, raw_input
There may be some other differences but those should take care of the
larger ones.
HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111117/548d6e7b/attachment-0001.html>
More information about the Tutor
mailing list