Goodbye, python 2. Hello, python 3

Hearing people's feathers hanging 2020-11-12 23:15:59
goodbye python hello python


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 ”.


Python 3- future


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 .





本文为[Hearing people's feathers hanging]所创,转载请带上原文链接,感谢

  1. 利用Python爬虫获取招聘网站职位信息
  2. Using Python crawler to obtain job information of recruitment website
  3. Several highly rated Python libraries arrow, jsonpath, psutil and tenacity are recommended
  4. Python装饰器
  5. Python实现LDAP认证
  6. Python decorator
  7. Implementing LDAP authentication with Python
  8. Vscode configures Python development environment!
  9. In Python, how dare you say you can't log module? ️
  10. 我收藏的有关Python的电子书和资料
  11. python 中 lambda的一些tips
  12. python中字典的一些tips
  13. python 用生成器生成斐波那契数列
  14. python脚本转pyc踩了个坑。。。
  15. My collection of e-books and materials about Python
  16. Some tips of lambda in Python
  17. Some tips of dictionary in Python
  18. Using Python generator to generate Fibonacci sequence
  19. The conversion of Python script to PyC stepped on a pit...
  20. Python游戏开发,pygame模块,Python实现扫雷小游戏
  21. Python game development, pyGame module, python implementation of minesweeping games
  22. Python实用工具,email模块,Python实现邮件远程控制自己电脑
  23. Python utility, email module, python realizes mail remote control of its own computer
  24. 毫无头绪的自学Python,你可能连门槛都摸不到!【最佳学习路线】
  25. Python读取二进制文件代码方法解析
  26. Python字典的实现原理
  27. Without a clue, you may not even touch the threshold【 Best learning route]
  28. Parsing method of Python reading binary file code
  29. Implementation principle of Python dictionary
  30. You must know the function of pandas to parse JSON data - JSON_ normalize()
  31. Python实用案例,私人定制,Python自动化生成爱豆专属2021日历
  32. Python practical case, private customization, python automatic generation of Adu exclusive 2021 calendar
  33. 《Python实例》震惊了,用Python这么简单实现了聊天系统的脏话,广告检测
  34. "Python instance" was shocked and realized the dirty words and advertisement detection of the chat system in Python
  35. Convolutional neural network processing sequence for Python deep learning
  36. Python data structure and algorithm (1) -- enum type enum
  37. 超全大厂算法岗百问百答(推荐系统/机器学习/深度学习/C++/Spark/python)
  38. 【Python进阶】你真的明白NumPy中的ndarray吗?
  39. All questions and answers for algorithm posts of super large factories (recommended system / machine learning / deep learning / C + + / spark / Python)
  40. [advanced Python] do you really understand ndarray in numpy?
  41. 【Python进阶】Python进阶专栏栏主自述:不忘初心,砥砺前行
  42. [advanced Python] Python advanced column main readme: never forget the original intention and forge ahead
  43. python垃圾回收和缓存管理
  44. java调用Python程序
  45. java调用Python程序
  46. Python常用函数有哪些?Python基础入门课程
  47. Python garbage collection and cache management
  48. Java calling Python program
  49. Java calling Python program
  50. What functions are commonly used in Python? Introduction to Python Basics
  51. Python basic knowledge
  52. Anaconda5.2 安装 Python 库(MySQLdb)的方法
  53. Python实现对脑电数据情绪分析
  54. Anaconda 5.2 method of installing Python Library (mysqldb)
  55. Python implements emotion analysis of EEG data
  56. Master some advanced usage of Python in 30 seconds, which makes others envy it
  57. python爬取百度图片并对图片做一系列处理
  58. Python crawls Baidu pictures and does a series of processing on them
  59. python链接mysql数据库
  60. Python link MySQL database