Mar 10, 2016
Most Python programmers agree that Python 3, which has been available since 2008, is a big improvement over Python 2, but many (most?) Python developers are still using Python 2. The main reasons for this, according to a 2014 survey, are:
But there are now clear signs that Python 2, which one developer argues we should start calling “Legacy Python”, is on it’s way out. Officially, its “End of Life” is scheduled for 2020 (see PEP 373), which is only four years away. Any Python 2 code written today is not likely to have a long shelf life.
More and more developers are making the switch.
This query of the StackExchange data shows that in Q1, 2016, there have been almost as many Python 3-tagged posts as there were Python 2-tagged posts.
In Q1, 2014, there were slightly more than 1.71 Python 2 posts for every Python 3 post. Two years later, in Q1, 2016, there are fewer than 1.1 Python 2 posts for every Python 3 post.
We are likely to see a snowball effect here. With Python 2 being officially put to rest in 2020 and as more and more Python 2 packages that developers rely on are ported to Python 3, we will see more and more developers making the switch. I believe the smart decision is to make this switch earlier rather than later.
Another piece of date, which I’m unsure how to interpret but I want to share in case others have thoughts, is this Google Trends chart, which shows that there are about twice as many searches for Python 3 as there are for Python 2 and that this has been the case for some time.
That would seem to indicate that more people are searching for Python 3 resources than for Python 2 resources, but two issues make me wonder if that’s true:
First issue: if you search for anything about Python without specifying the version (e.g., Python Unicode), the first result is almost always the Python 2.7 documentation and the second result is the Python 3.5 documentation. I expect that Google returns the result most people want (i.e., click on) first and its algorithm tells it that people searching for generic Python information are more often looking for Python 2.7 than Python 3.5. It will be interesting to see when this changes.
Second issue: The slope of the lines is about the same. There were about twice as many Python 3 searches in January, 2016 as there were in January, 2013. And the same is true for Python 2 searches.
Regardless, Python 3 is here to stay and Python 2 is not. So, if you’re writing code in Python 2 today, you may find yourself rewriting or at least reworking that code in the next few years, which won’t be fun.
Also, if you and/or your team are currently learning Python, I agree with the recommendation on python.org that you first learn Python 3. Then, if your project requires you to know Python 2, you learn the differences, which are simple, but could be pervasive, meaning you won’t have any trouble learning and understanding the differences, but you may have to apply them often.
Related Training: Python