Recently, I was trying to rescue someone from the evil world of Ruby or PHP (every Pythonistas holy mission), when they made this comment:
I just realised there is the Python 2 vs 3 can of worms
And I sighed.
Should you choose Python 2 or Python 3
This was a big problem for me…….. in 2014. I was working on a big personal project, and I didn’t want to make the wrong choice. Ultimately, I stuck to Python 2, but added from future import everything to all my code. That basically means using Python 3’s features in Python 2 (when available).
At that time, most forums were in a disarray. Trolling wars were going on, battles raged on in Reddit, cities were burnt down, sheeps pillaged and ravaged etc etc. You get the idea.
Here’s your Unicode support, b***h
But in the last year or so, especially since 2015, I’ve noticed a pattern. It has been very subtle, and you would miss it unless you spent a lot of time on places like Reddit’s /r/python (which, last time I checked, was the biggest programming subreddit). The pattern was this:
Slow, quietly, Python3 was gaining ground. The holy wars stopped, the number of people recommending Python 3 increased, and the overall tone went from very screechy and screaming to calm and measured.
Om Shanti Shanti. Python 3, Shanti shanti
There seemed to be a general acceptance that Python3 is here to stay. Python 2 will be continued to be used in many (most?) companies, but then there are companies still using Cobol, Pascal, or (makes me want to shudder just thinking about it) Visual SourceSafe (Google it if you’ve never heard of it).
Some companies will never upgrade. Some will do so when kicked. Some are already starting new projects in Python 3, keeping the legacy projects as they are. Some have a plan, but will wait until Python 2 is officially not supported anymore. Ubuntu 16 now comes with Python3 installed by default (though not pip, which baffles me, it’s so stupid).
But, most people outside the hardcore Python community don’t know this
You can blame Google if you want. The top results for Py2 vs 3 are all from 2013-2014, with a handful of 2015s. That’s how Google works- older entries get higher ranked. But that means people new to Python are reading about debates that happened 2-3 years ago, debates that no longer matter.
If you are new to Python: Choose Python 3. The differences are minor, but 3 is the language going forward. I use both 2 & 3 (as companies will continue to use Python2 for some time), and don’t find the differences that big. For everyday use cases, 90% of the language is the same (I don’t care about small things like print()). Unless you go work for a company that uses the latest and greatest (Asyncio with Redis working on Hadoop!), you will not find too much of a difference.
Old timers: Realise that there is still a lot of confusion out there, especially among beginners. Give them an easy answer (Choose Python 3), without forcing them to go thru debates which happened years ago.
I’ll let you get back to work now
PS: Want a free pdf, Python: From Apprentice to Master?
Subscribers will also get exclusive content I won't share on my blog.