Kajigga
Posted on October 15, 2017
It's a huge point of conversation.
The internet has been debating the merits of Python 2 vs Python 3 for years now. I am sure the Python foundation would love for everyone to have switched entirely to Python 3 by now. There are reasons to migrate to it and, at least some feel, reasons to stay on 2.7.
I'll summarize the differences then give my own opinionated take on the whole thing. (Hint: I think everyone should be using Python 3)
Python 2.7
Python 2.7.13, the most recent version of the 2.x series, came out way back in 2010.
Problems with Python 2.7
No new features have been introduced since that time. The Foundation releases bug fixes but new functionality will only be added to Python 3.
Python 3.x
Pros
- Iterators, generators
- Many lists that would have been in memory lists with 2.7 are generators in Python 3. This make high memory functions much more efficient. There are some disadvantages but I won't go into detail here.
- True UTF8 support - all strings are utf8 by default (Huge win!)
- New features will be added to Python 3
- It is not 7 years since the last release
Cons
- Some libraries have not yet been migrated over to support Python 3. This is a huge problem for some people that have code written to rely on these libraries. However, it is my opinion that if the library isn't popular enough to demand a Python 3 version then it may not be necessary. That or get with the game people.
- I should note that it has been years since I ran into a library that I wanted to use that didn't work in Python 3.
My Opinion
Use Python 3 unless you absolutely have to use Python 2 for some reason. Python 3 is faster and better supported. All of the solutions I share on Scripting With Python are written with Python 3 first in mind. I may occasionally test them with Python 2 but I won't guarantee it.
Posted on October 15, 2017
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
June 13, 2021