Home > News content

The time has come for Python 2! 113days later, self-made and self-defeating, with an upgrade guide.

via:博客园     time:2019/9/10 12:31:52     readed:109

Gan Ming chestnuts come from the temple.

Quantum bit report official account QbitAI

Python 2 finally came to an end.

The official announcement is that the closing date of Python 2 will be when the bell rings for the new year (January 1, 2020).

After that, Python 2 was born and died, and even if the sky fell, the authorities would not improve.

They explained that they did not want to hurt Python 2 users, the decision was for the good of Python users.

Only by giving up Python 2 can they make Python 3 better.

This move has received a lot of support and understanding:

data-ratio=0.7471264367816092

Some people also read the old.

Some netizens began to put words, saying that they would support the maintenance and update of Python2, no reason, just want to use Python2.

However, with the official support for Python 2 no longer available, there have also been a number of tools that have announced in recent years that they have abandoned support for Python 2. For example, TensorFlow, Pandas, Numpy, Jupyter Notebook, Cython and other tools.

data-ratio=0.458528951486698

If you want to make good use of Python, in front of Python 2 users, there seems to be only one way:

Upgrade to Python 3.

Upgrade strategy

On the way to upgrade, there will be a lot of questions. Python officials answered a wave of questions for you first:

1. What happens if it is not updated before January 1, 2020?

If anyone finds a catastrophic security leak in Python 2, not many people will volunteer to fix it.

Need Python 2's help, and there won't be many people to help you. As time goes on, there will be fewer and fewer people who can help you.

Many good tools don't work because only Python 3 supports them. In that case, you may also be a drag on those who work with you.

Some of these problems will start on January 1, while others will become more and more serious over time.

2. How do I migrate the code I wrote in Python 2 to Python 3?

Chinese documents are provided. The steps are described in detail, which can be automatically migrated. In addition, from 2 to 3, some functions have changed. There is a list in the document. You can search for it by yourself and modify it manually.

data-ratio=0.779126213592233

Chinese document: 2 to 3 - Automatically converts Python 2 code to Python 3 code.

Https://docs.python.org/zh-cn/3.7/library/2to3.html

In addition, there are two English documents to refer to:

Porting Python 2 Code to Python 3

https://docs.python.org/3/howto/pyporting.html

Python 3 Statement Practicalities

https://python3statement.org/practicalities

3. I'm not sure if the software I use will depend on Python 2. What should I do?

If you bought the software from suppliers, just ask them. If you are paying developers or system administrators, ask these people.

If you can't find the relevant suppliers and technicians, useCan I Use Python 3?

Can I Use Python 3:

https://pypi.org/project/caniusepython3

To find out about some specific tools that are not compatible with Python 3, see Python 2.7 Readiness, Python 3 Statement, and Python 3 Readiness.

4. I still rely on some software written in Python 2. What should I do?

Similarly, ask vendors and technical support staff if you are paying developers or system administrators.

If you can't ask, useCan I Use Python 3?

Can I Use Python 3:

https://pypi.org/project/caniusepython3

5. Can someone help me?

Yes. If you can pay for Extended Support, contact these vendors:

https://wiki.python.org/moin/PythonConsulting/Python 2 support and migration

There may be more than that in your mind, but now you may need some encouragement to complete the migration smoothly, so take a look at Hacker News's message on the top floor (@ken):

Python 2 to 3 is one of the simplest migration I've ever made.

There's one named

Six library portal:

https://pypi.org/project/six

Python 2 Past

Python originated in the late 1980s, when Guido van Rossum, the founder of Python, was working on Amoeba distributed computing systems in CWI (Netherlands Institute of Mathematics and computer), using C and Unix shell..

In this process, he gradually felt uncomfortable with these languages, not only running too slowly to handle complex logic, but also had to repeat the wheel.

data-type=gif

So Guido had the idea of creating Python in his spare time. In 1991, the first edition of Python was published, which can be said to be a combination of strengths.

Since 2003, Python has been in the top 10 of TIOBE's most popular programming languages.

Python won the TIOBE programming language of the year Award in 2007. The award is awarded to the most popular programming language of the year, based on the TIOBE index.

Python 2 was also favored by big companies at that time: many well-known companies including Google, Facebook and Amazon were using it, including large applications such as YouTube and Reddit, all from Python.

NASA, a research firm, also uses Python to simplify the mission process design of the space shuttle to explore space.

Among them, although there is the credit of Python2, there are also Python based on the change of times.

Python 3 Future

With the increasing of computing force, computing platform changes, Python.

In 2008, in order to repair defects, better adapt to the new environment and make Python more viable, the Python community made a very decisive move:

Launch Python 3, not backward compatible.

The Deadline for Python 2.7 was set in 2015. Fearing that a large number of existing code could not be migrated to Python 3, the time was delayed to 2020.

Behind this long pain is not as short as the idea of light forward, and so on, most developers understand.

Moreover, it has won Python many usage scenarios, the most typical of which is to become the darling of machine learning, a hot field.

Google's TensorFlow uses Python.Facebook more directly, knowing from the name of PyTorch that it is inextricably linked to Python.

data-type=png

But the pain caused by the split version has become a major focus of Python's criticism.

Although Python has also released programs to help developers better convert Python 2 code to Python 3.

But this also makes many people tangle and wander, and more opponents see the opportunity, and the aggressive.

For example, Google officially launched Go, in 2009.

And Julia. This new programming language, originating from MIT, was created in the second year of the release of Python 3 and released publicly in 2012.

The main application areas are data analysis, machine learning, physics, mathematics, artificial intelligence, signal and image processing, and so on.

data-type=png

All of these are the core positions for Python to play a role and face the future.

However, Python has not stopped the pace of development, but also constantly innovative, future-oriented programming.

For example, PyPy's continuous optimization, SciPy and NumPy's continuous improvement and so on, are magnifying Python's energy.

Now, the countdown to Python's resignation has been suspended.

This amateur project language, which started in the 1980s, still has super vitality and compatibility, and has become a sharp weapon in the hands of developers, constantly engulfing the world.

data-ratio=0.13009404388714735

China IT News APP

Download China IT News APP

Please rate this news

The average score will be displayed after you score.

Post comment

Do not see clearly? Click for a new code.

User comments