Python2 The exit of , It means the end of an era
Our generation of programmers have been exposed to python2, Many people also come from python2 The times are coming . however , It's time to say goodbye .
although Python Father announced two years ago Python 2.7 Will be in 2020 year 1 month 1 End of support , But the debate about the version never stops . Now? ,python2 The day to stop updating has come , This means that developers will not receive any more from Python 2.7 Bug fixes or security updates .
I am here 18 In, a blog once mentioned python2 and python3 The choice of learning , At that time, many people asked me , learn python3 still python2. My answer is 3 best ,2 It's fine too , It doesn't matter if you study , There is no big difference between them .
It's almost two years since now , Through an era of ups and downs ,Python 2 Finally came to the end . Someone once predicted python I can't live 10 year , however python Its simplicity , And more recently 10 The rise of artificial intelligence and data science , bring python Give life to , Has become one of the current mainstream programming languages .
Although it has many disadvantages , But it's become a lot of people work 、 Script language is indispensable in life .
Just yesterday ,python Official announcement , When the bell rings in the new year （2020 year 1 month 1 Japan ）, Namely Python 2 The closing day . This means that after ,Python 2 die , The government will no longer maintain and improve .
The official saying is
Just give up Python 2, We can make Python 3 Get better .
Some people are nostalgic , Show that you will support Python2 Maintenance and update of , Why not? , I just want to use Python 2.
But as officials no longer support Python 2, In recent years, a large number of tools have also announced to give up support Python 2. such as TensorFlow、Pandas、Numpy、Jupyter Notebook、Cython Tools such as .
such as Fedora. To solve this problem , Get rid of it as soon as possible Python 2 Dependence , Based on Python 2 The best choice is to remove all the packages . But it will be more troublesome in practice , And can cause disruptive changes to the system ,Fedora Several developers of have submitted a deprecation Python 2 Unified process proposal for software package , Want to remove Python 2 Software packages are more controllable , Give Way Python 2 The impact of retirement is reduced .
The proposal describes several processes in detail , Mainly related to Python 2 subpackage（ subpackage ）、module（ modular ） And requirement（ The operating environment depends on ） And so on several aspects processing ：
Through a process similar to isolation ,Python 2 Subpackages can be easily discarded .
There is no other function Python 2 The module will be removed .
Unnecessary environmental dependencies will be removed .
Fedora The community will gather information to help “ project management ”.
Non installable... Will be removed from the system Python 2 package .
If you want to use it well Python, Put on Python 2 There seems to be only one way in front of users ：
Upgrade to Python 3.
Python 2 Once upon a time in
Python Derived from 20 century 80 End of the decade , at that time Python The creator of the Guido van Rossum is CWI（ Dutch Institute of mathematics and computer ） Research Amoeba Distributed computing system , Use C and Unix shell. In the process , He gradually became unhappy with the language , Not only is it too slow , Can't handle complex logic , I have to make wheels again .
1989 Christmas period of , To spend time in Amsterdam , Determined to develop a new interpreter , As ABC An inheritance of language .ABC It's a teaching language designed by Guido , In Guido's own opinion ,ABC This language is very beautiful and powerful , Designed for non professional programmers .
however ,ABC Language didn't work .
The reason is , Guido thinks it's non development . Guido is determined to Python Avoid this mistake , And achieved very good results .
selected Python（ Python ） As the name of the program , It's because he is BBC TV play -- Monty Pearson's Flying Circus （Monty Python’s Flying Circus） Lovers .
1991 year , first Python The birth of interpreter , It is to use C The realization of language , And be able to call C Library files for languages .
1999 year , Guido DARPA Submitted an article called ”Computer Programming For Everybody” The application for funds , And later explained that he was right Python The goal of ：
1. A simple and intuitive language and as powerful as the main competitors
2. Open source , So that anyone can contribute to it
3. The code is as easy to understand as pure English
4. Daily tasks for short-term development
The fundamentals of these ideas have become a reality ,Python Has become a popular programming language
Python2 The design of the philosophy
1. Python2 The philosophy of developers is ： In a way , It's better to have only one way to do one thing
2. If there are multiple options ,Python2 Developers generally reject fancy Syntax , And choosing a grammar that is unambiguous or rarely ambiguous
stay Python Community , Guido is called “ A benevolent dictator ”
Python stay 2007 He got it in 2000. TIOBE Programming language of the year . The award is based on TIOBE Index , The most popular programming language of the year .
Python 2 At that time, it was also favored by large companies ： Include Google、Facebook、 Amazon and many other famous companies are using it , Include YouTube、Reddit Large applications inside , It's all from Python.
Scientific research institutions NASA Also use Python To simplify the mission flow design of the space shuttle , To explore space .
“ Life is too short , I use Python” Become familiar to most programmers “ stem ”,Python It has also become a language that engulfs the world . In between , Although there are Python2 Credit , Also have Python Based on circumstances “ Transformation ”.
With the increase of computing power , The computing platform has changed ,Python This article “ Python ” In the new operating environment , It's getting better and better .
2008 year , In order to fix the defect , Better adapt to the new environment , Give Way Python More vitality ,Python The community made a very decisive move ：
Introduction python3, Backward incompatibility
At that time Python 2.7 Set down Deadline yes 2015 year . Because I'm worried that a lot of existing code can't be migrated to Python 3, The time has been put off again 2020 year .
The idea that the long pain is better than the short one , The concept of light clothing and so on , Most developers understand .
and , This is also for Python Won a lot of use scenarios , The most typical is to become a favorite of machine learning .
Google's TensorFlow What you use is Python.Facebook More direct , from PyTorch We know it and Python An inextricable connection .
But the pain of the split version , Or become Python A major point of criticism . although Python Also released the program , Help developers to better integrate Python 2 Code conversion to Python 3.
But it also makes many people tangle and wander , More opponents see the opportunity , And it's a menace .
For example, Google. 2009 Officially launched in Go, But also “ in a flagrant way ” To rob people —— Develop one from Python 2.7 To Go Compiler of language .
also Julia. This comes from MIT New programming language , Founded in Python 3 The second year of release ,2012 Published in .
The main application area is data analysis 、 machine learning 、 physics 、 mathematics 、 Artificial intelligence 、 Signal and image processing, etc .
And these , It's all the present Python Play a role 、 The core position for the future . however ,Python I didn't stop to develop , It's also constantly bringing forth new ideas , Programming for the future .
such as PyPy The continuous optimization of ,SciPy and NumPy And so on , They're all zooming in Python Energy .
Now? ,Python The old countdown has been suspended .
This comes from 20 century 80 The language of an amateur project in the s , It still has strong vitality , Absorb anything and everything , Become a weapon in the hands of developers , Devour the world .
Python 2, Thank you for your loyal service over the years .
Python 3, This is your time .