Python development origin and basic knowledge

1. Introduction to Python development

1. Introduction to Python Authors

The author of Python, Guido von Rossum, Dutch. In 1982, Guido received a master's degree in mathematics and computer science from the University of Amsterdam. In 1989, he founded the Python language. At that time, he was still at CWI (Centrum voor Wiskunde en Informatica, National Academy of Mathematics and Computer Science) in the Netherlands. In early 1991, Python released its first public release. Guido originally lived in the Netherlands. He moved to the United States in 1995 and met his current wife. In early 2003, Guido and his family, including his son Orlijn, born in 2001, had been living in the suburbs of Northern Virginia, Washington.

In 2002, at the European Conference of Free and Open Source Software Developers in Brussels, Belgium, Guido Van Rossum received the 2001 Free Software Progress Award issued by the Free Software Foundation.
In May 2003, Guido won the Dutch UNIX User Group Award.
In 2006, he was recognized as a famous engineer by the American Computer Society (ACM).
In December 2005, Guido Van Rossum joined Google. He wrote a web-oriented code browsing tool for Google in Python. There he spends half of his time maintaining Python development.
On December 7, 2012, Dropbox announced that Guido Van Rossum had joined Dropbox.

2. Introduction to Python development

In 1989, in order to pass the Christmas holiday, Guido began to write a compiler for the Python language. The name Python comes from Guido's beloved TV series Monty Python's Flying Circus. He hopes that this new language called Python can meet his ideals: to create a comprehensive, easy-to-learn, easy-to-use, and extensible language between C and shell.
  In 1991, the first Python compiler was born. It is implemented in C language and can call C language library files. From its birth, Python has: classes, functions, exception handling, core data types including tables and dictionaries, and a module-based expansion system.
  In 1999, Granddaddy of Python web frameworks, Zope 1 was released in 1999
  In 1994, Python 1.0-January 1994 added lambda, map, filter and reduce.
  In 2000, Python 2.0-October 16, 2000, added a memory recovery mechanism, Form the basis of the current Python language framework.
  In 2004, Python 2.4-November 30, 2004, the same year the most popular WEB framework Django was born in
  2006, Python 2.5-September 19, 2006
  2008, Python 2.6-October 1, 2008
  2010 , Python 2.7-July 3, 2010
  2014年,In November 2014, it was announced that Python 2.7 would be supported until 2020, and reaffirmed that there would be no 2.8 release as users were expected to move to Python 3.4+ as soon as possible
  2008年,Python 3.0 - December 3, 2008
  2009年,Python 3.1 - June 27, 2009
  2011年,Python 3.2 - February 20, 2011
  2012年,Python 3.3 - September 29, 2012
  2014年,Python 3.4 - March 16, 2014
  2015年,Python 3.5 - September 13, 2015
  2015年,Python 3.5.1, documentation released on 07 December 2015.
  2016年,Python 3.5.2, documentation released on 27 June 2016.
  2016年,Python 3.6.0, documentation released on 23 December 2016.
  2017年,Python 3.6.1, documentation released on 21 March 2017.

If you read carefully, users will definitely find out why Python 3.0 was released in 2008, and why was Python 2.7 released in 2010? This is because when Python 3.0 was released, Python 2.0 was not supported. , Resulting in many users unable to upgrade to the new version normally, so a transitional version of Python2.7 was released later, and Python2.7 will be supported until 2020, so novices should start with Python3.0.

2. The main application areas of Python at present:

Cloud computing: The most popular language for cloud computing, typical applications OpenStack
WEB development: Many excellent WEB frameworks, many large websites are developed in Python, Youtube, Dropbox, Douban. . . , Typical WEB frameworks include Django
scientific calculations and artificial intelligence: Typical libraries NumPy, SciPy, Matplotlib, Enthought libraries, pandas
system operation and maintenance: essential language for operation and maintenance personnel
Finance: quantitative trading, financial analysis, in the field of financial engineering, Python is not only Used, and used the most, and its importance is increasing year by year. Reason: As a dynamic language, Python has a clear and simple language structure, rich library, mature and stable, scientific calculation and statistical analysis are very good, production efficiency is much higher than c, c++, java, especially good at strategy
backtest graphical GUI: PyQT , WxPython,TkInter

3. The application of Python in some companies:

Google: Google App Engine, code.google.com, Google earth, Google crawler, Google ads and other projects are all using Python to develop
CIA: The CIA website is developed in Python.
NASA: NASA uses Python extensively Data analysis and calculation
YouTube: The world's largest video website YouTube is developed with Python
Dropbox: the largest online cloud storage website in the United States, all implemented in Python, the website handles the upload and download of 1 billion files every day
Instagram: the largest picture in the United States Sharing on social networking sites, more than 30 million photos are shared every day, all developed in python.
Facebook: a large number of basic libraries are implemented through Python.
Redhat: The yum package management tool in the most popular Linux distribution in the world is developed with python
Douban: Almost all of the company’s business is developed through Python.
Know: The largest Q&A community in China, developed through Python (Quora abroad)
Dr. Chun Yu: Well-known online medical websites in China are developed using Python.
In addition to the above, there are Companies such as Sohu, Jinshan, Tencent, Shanda, Netease, Baidu, Ali, Taobao, Tudou, Sina, and Guok are all using Python to complete various tasks.

Fourth, what kind of programming language is Python

Programming languages ​​are mainly classified from the following perspectives: compiled and interpreted, static and dynamic languages, strongly typed definition languages ​​and weakly typed definition languages. What does each category mean? Let's take a look together.

What is the difference between compilation and interpretation?
The compiler compiles every statement of the source program into machine language and saves it into a binary file, so that the computer can run the program directly in machine language at runtime, which is very fast;

The interpreter is only when the program is executed, it is interpreted one by one into machine language for the computer to execute, so the running speed is not as fast as the compiled program.

This is because the computer cannot directly recognize and execute the sentences we write, it can only recognize machine language (in binary form)

Compiled vs interpreted

Compiled

Advantages: The compiler generally has a pre-compilation process to optimize the code. Because the compilation is done only once and no compilation is required at runtime, the program execution efficiency of the compiled language is high. Can run independently from the language environment.
Disadvantage: If you need to modify after compilation, you need to recompile the entire module. When compiling, the machine code is generated according to the corresponding operating environment. There will be problems in porting between different operating systems. Different executable files need to be compiled according to the operating operating system environment.

Interpretive

Advantages: It has good platform compatibility and can run in any environment, provided that an interpreter (virtual machine) is installed. Flexible, you can modify it directly when you modify the code, and it can be deployed quickly without downtime for maintenance.

Disadvantages: It must be explained every time it runs, and its performance is not as good as a compiled language.

Python is a dynamically interpreted strongly typed definition language.

Five, the advantages and disadvantages of Python

advantage:

1. The positioning of Python is "elegant", "clear", and "simple", so Python programs always look simple and easy to understand. For beginners to learn Python, it is not only easy to get started, but also in the future, you can write very, very complicated ones. program.
2. The development efficiency is very high. Python has a very powerful third-party library. Basically, you want to achieve any function through the computer. There are corresponding modules in the official Python library to support it. After downloading and calling directly, it will be based on the basic library. Carrying out development, greatly reducing the development cycle and avoiding repeated wheels.
3. High-level language-When you write a program in Python, you don't need to consider low-level details such as how to manage the memory used by your program.
4. Portability-due to its open source nature, Python has been ported to many platforms (it has been modified so that it can work on different platforms). If you carefully avoid using system-dependent features, then your Python program can run on almost all system platforms on the market without modification.
5. Scalability-If you need a piece of your key code to run faster or want some algorithms not to be made public, you can write part of your program in C or C++, and then use them in your Python program.
6. Embeddability-You can embed Python into your C/C++ program to provide stepping functions to users of your program.

Disadvantages:

1. The speed is slow. The running speed of Python is indeed much slower than that of the C language, and slower than that of Java. Therefore, this is the main reason why many so-called big cows disdain to use Python, but in fact the running speed referred to here Slowness is not directly perceivable by users in most cases, and it must be reflected by testing tools!
2. The code cannot be encrypted, because Python is an interpreted language, and its source code is stored in plaintext, but I don’t think this is a disadvantage. If your project source code must be encrypted, you don’t have to Should be implemented in Python.
3. Threads cannot use multiple CPUs. This is one of the most criticized shortcomings of Python. GIL stands for Global Interpreter Lock. It is a tool used by computer programming language interpreters to synchronize threads. A thread is executing, and the Python thread is the native thread of the operating system. It is pthread on Linux and Win thread on windows. The execution of threads is scheduled by the operating system. There is a main circuit in a Python interpreter process, and multiple execution threads of user programs. Even on a multi-core CPU platform, due to the existence of the GIL, parallel execution of threads is prohibited. Regarding the compromise solution to this problem, we will discuss it in detail in the chapters on threads and processes.

Six, Python interpreter

When we write Python code, what we get is a text file with a .py extension that contains Python code. To run the code, you need a Python interpreter to execute the .py file.

Since the entire Python language is open source from the specification to the interpreter, in theory, as long as the level is high enough, anyone can write a Python interpreter to execute Python code (of course it is very difficult). In fact, there are many Python interpreters.

After CPython
officially downloaded and installed Python2.7, we directly obtained an official version of the interpreter: CPython. This interpreter is developed in C language, so it is called CPython.
CPython is the most widely used Python interpreter. By default, all code is also executed under CPython.

IPython is an interactive interpreter based on CPython, that is, IPython is only enhanced in interactive mode, but the function of executing Python code is exactly the same as CPython. For example, although many domestic browsers have different appearances, the kernel actually calls IE.

CPython uses >>> as the prompt, and IPython uses In [serial number]: as the prompt.

PyPy is said to be the future of Python, and developers also said that they want to use this interpreter for your Python code blocks.
PyPy is another Python interpreter whose goal is execution speed. PyPy uses JIT technology to dynamically compile Python code (note that it is not an interpretation), so it can significantly improve the execution speed of Python code.
Most of the Python code can be run under PyPy, but PyPy and CPython have some differences, which leads to different results when the same Python code is executed under the two interpreters. If your code is to be executed under PyPy, you need to understand the differences between PyPy and CPython.

Jython
Jython is a Python interpreter running on the Java platform, which can directly compile Python code into Java bytecode for execution.

IronPython
IronPython is similar to Jython, except that IronPython is a Python interpreter running on the Microsoft .Net platform, which can directly compile Python code into .Net bytecode.

Summary: There are many interpreters for Python, but CPython is the most widely used. If you want to interact with Java or .Net platforms, the best way is not to use Jython or IronPython, but to interact through network calls to ensure the independence between programs.

Seven, use Python2 or Python3

The official recommendation is to upgrade to Python3 as soon as possible, and Python3 has many new functions and features, so unless some businesses are written in Python2, Python3 is generally recommended.

Original reference: https://www.cnblogs.com/xincai/p/7058551.html

Guess you like

Origin blog.csdn.net/qq_43307934/article/details/112056167