[Tutor] Python 2 Vs python 3
Steven D'Aprano
steve at pearwood.info
Sun Jul 13 19:55:29 CEST 2014
On Sun, Jul 13, 2014 at 12:16:16PM -0400, idiallo.spsu at gmail.com wrote:
> Hi All,
> 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?
If you have a book that teaches Python 3, use Python 3. If it teaches
Python 2, use Python 2.
If you have a choice, and you know that your aim is to use some specific
library that only works with Python 2, then use Python 2. Otherwise, if
you're learning the language with no fixed plans, then Python 3 is
better.
The main differences include:
- some of the standard libraries have been moved or renamed;
- strings are Unicode text instead of 8-bit bytes;
- a couple of minor syntax differences (e.g. "print" is a
statement in Python 2, a function in Python 3);
- Python 2.7 is the last of the 2 series and will have no
new features, while Python 3 is in active improvement.
Don't feel bad about using Python 2 if you must. Version 2.7 will be
supported until at least 2020, so you will have plenty of time to
upgrade in the future. But Python 3 really is better.
--
Steven
More information about the Tutor
mailing list