As the current
The most popular programming languagePython is one of the most commonly used languages in the field of artificial intelligence, making computer programming no longer a technical skill but a universal tool that everyone can learn and use. But in three months, Python will undergo perhaps the biggest change in its history.
There are still some developers who maintain Python2 as volunteers. But they have collectively decided that January 1, 2020, will be the day Python2 “ends its life.” After that date, all Python2-related maintenance is terminated.
Readers who don’t know much about programming may wonder: Why doesn’t someone update when Python3 is always mentioned as being so much better than Python2?
1. Engineering stability is more important than software update speed.
Programming language is the cornerstone of software, if the programming language has been updated, software update is not a small thing, it needs to update all the code comprehensively. In this process, if the old version is incompatible with the old version, the code stability deteriorates, etc., it may affect the continuous use of users. Therefore, for some version iterations, many software developers choose not to update. Rather than rush to update to the latest version, it is better to ensure user stability.
2. Python officially “allows” Python2 to persist.
Python officials also mention in the documentation that major updates can “hurt” developers. In particular, if developers had been quickly asked to abandon Python2 in 2006, many developers would have simply abandoned Python because of the cost of development. A thriving developer community is essential to maintaining Python’s status as a programming language, so officials have been updating the maintenance of Python2 to keep more developers in the community.
Python2 does work.
Although Python2 has many major problems compared to Python3, Python2 is still a developer-friendly version of Python, supported by many open source libraries from the Python2 era. Therefore, some developers want to continue using Python2.
For these reasons, Python3’s replacement of Python2 was delayed for more than a decade. However, with the development of machine learning, the field of machine learning has high performance requirements for programming languages, and most of the new tools support Python3. Therefore, using Python3, which has better performance and more tool support, is a natural choice for developers.
Drop the list of software that supports Python2
In 2017, heart of the machine reported that it would drop Python2 as an open source tool. Now the list is much longer.
The following table shows when multiple projects decided to stop supporting Python 2. This table tells you whether a version of each project supports Python 2, the release timeline, and when to extend support. (Python time line: https://docs.python.org/devguide/#status-of-python-branches)
At the same time, some related questions are provided by the government.
Why terminate Python2?
A: Python2 was terminated because we wanted to help developers better.
Python2 was released in 2000. After a few years, we realized that we needed a major update to Python. So in 2006, we started work on Python3. Because a lot of people didn’t update at the time, and we didn’t want to harm them with this update, we’ve been maintaining and publicizing new versions of Python2 and Python3 for years.
But this makes maintaining Python very difficult. Python2 has some improvements and maintenance that are difficult to follow. This will take the effort out of improving Python3’s speed and performance.
Moreover, if many people continue to use Python2, it will be harder for open source workers who develop programs in Python. They can’t use the new features in Python3 to make open source tools more usable.
We didn’t want to hurt developers using Python2, so in 2008, we announced that Python2 would be discontinued in 2015 and we wanted people to update it. At that time, some people updated, but others stayed on Python2, so we pushed the termination date back to 2020.
How long does Python2 currently have to live?
A: There are three months and 21 days left from September 10, 2019. There is a countdown, at pythonClock.org (https://pythonclock.org/).
What happens if there is no upgrade?
A: Even if a user discovers a catastrophic security problem on Python2 or in software developed by Python2 after the expiration date, the volunteers will not help fix it. If a user needs python2-related software assistance, volunteers will not help, and fewer and fewer volunteers will be able to help these users. At the same time, users may lose access to good open source tools because they are developed based on Python3. At the same time, users using Python2 may slow down the work of others developing using Python3.
How do I convert Python2 code to Python3?
A: Please refer to the official guidance.
The guidelines address: https://docs.python.org/3/howto/pyporting.html
What should users do if they develop some software based on Python2?
A: If the software or software support is purchased from a vendor, consult them for details; If you paid for your software from a developer or system administrator, consult those developers or administrators. If neither, click “Can I Use Python3?” Page to find the tools needed to upgrade to Python3.
Caniusepython3 page address: https://pypi.org/project/caniusepython3/
Is there someone available to help users?
A: Yes. If you are paying for extended support, contact the vendor. If you can pay someone to help you, post on a job board or hire a consultant. If you need volunteers to provide free help, you can view the following help page: https://www.python.org/about/help/.
Users have not heard about the Python2 upgrade until now. Where were the upgrade notifications announced?
A: We’ve discussed Python2 upgrades at software conferences, Python notification mailing lists, official Python blogs, reference books and technical articles, social media, and with companies that sell Python support.
How can users ensure that they receive timely notifications of upgrades next time?
A: Purchase Python support from a vendor, or subscribe to the Python notification mailing list.
Subscribe to the address: https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Python2 will be thrown out of the picture. Even if there is a zero-day vulnerability there will not be security updates, users should upgrade, so as not to have security problems and not technical support.
Transfer as early as possible
Currently, the majority of well-maintained open source projects have migrated to Python 3. The Python2 projects you can find source code for are mostly projects that are no longer maintained earlier, or system-level projects (because Linux and MacOS both come with Python2.7). According to JetBrains’ latest Python developer survey, about 80% of developers are already using version 3.5+. Just two years ago, Python 3 was used by only a third of people.
Python has long provided 2 to 3 automation tools that can convert Python 2 code to 3 with a single command. On HackerNews, there was a lot of discussion about the end of Python 2 support.
Some netizens said: “Python 2 to 3 (at least version 3.3 and up) is one of the easiest transitions I’ve ever made. We can do this with the help of the library (Six), and in almost all cases you can write version 2 to version 3 compatible code, which means transitions can take place in small pieces at a time. As for dependencies, developers have also helped upgrade many third-party modules.”
In short, “if people had spent half as much time as complaining about this working out how to upgrade, moving to 3.x would have been done five years ago.” As a rule of thumb, unless your project has very rare and irreplaceable dependencies, or a large C language extension, versioning is easy.