Hi,

Answers are below.

 

From: Tutor [mailto:[email protected]] On 
Behalf Of [email protected]
Sent: Sunday, July 13, 2014 9:16 AM
To: Python Tutor Mailing List
Subject: [Tutor] Python 2 Vs python 3

 

I am in the process to dive into python and start learning it. But most books 
advice to install python 2 instead of ‎python 3. Any advice from the ones with 
the experiences and what is the main difference? 

 

JL: Python 2 and 3 series are backwards incompatible. For instance, whereas in 
Python 2, you can do something like:

print “hello”

In Python 3, you need to use:

print(“hello”)

There are other differences, including different division strategies, no more 
old objects and so on. Major concepts are same in Python 2 and 3, such as 
classes, exceptions and so on.

Many books recommend Python 2 because some popular libraries such as WXPython 
has not been ported to Python 3 yet, and Python Foundation announced that they 
are committed to releasing new 2.7.x series for those who would like to stay in 
Python 2 for a while (they just released 2.7.8 a few days ago). Once you’re 
comfortable with 2, using 3 isn’t hard (there are syntax differences you need 
to be aware of). These days, many libraries and projects are written with both 
Python 2 and 3 in mind for ease of porting to Python 3 in case Python 3 becomes 
more popular (not for now). There are also modules such as 2to3 which will try 
its best to convert Python 2 code to Python 3 with hand-written corrections 
required in the end.

You can install both Python 2 and 3 on the same computer (I have this setup 
under Cygwin). I myself speak Python 2 for now due to requirements for a 
project that I’m involved with.

Hope this helps.

Cheers,

Joseph

 

 

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to