The Origin of Python
The author of Python, Guido von Rossum, is indeed Dutch. In 1982, Guido received a master's degree in mathematics and computing from the University of Amsterdam. However, although he was a mathematician of sorts, he enjoyed computers even more. In his words, despite having dual qualifications in mathematics and computers, he always tends to do computer-related work and is keen on doing anything related to programming.
Guido von Rossum
At that time, he came into contact with and used languages such as Pascal, C, and Fortran. The basic design principle of these languages is to make machines run faster. In the 1980s, although IBM and Apple had set off a wave of personal computers, the configuration of these personal computers was very low (in today's terms). For example, the early Macintosh only had an 8MHz CPU frequency and 128KB of RAM. A large array could fill up the memory. The core of all compilers is to optimize so that the program can run. In order to increase efficiency, the language also forces programmers to think like a computer so that they can write programs that are more in line with the taste of the machine. In that era, programmers were eager to squeeze every inch of computer power with their hands. Some people even think that C language pointers are a waste of memory. As for dynamic typing, automatic memory management, object-oriented... don't think about it, it will paralyze your computer.
However, this way of thinking troubled Guido. Guido knows how to write a function in C, but the entire writing process takes a lot of time (even though he already knows exactly how to implement it). His other option is the shell. Bourne Shell has existed as an interpreter (interPReter) for UNIX systems for a long time. UNIX administrators often use shell to write some simple scripts to perform some system maintenance work, such as regular backup, file system management, etc. The shell can be like glue that connects many functions under UNIX together. Many programs with hundreds of lines in C language can be completed in just a few lines in the shell. However, the essence of the shell is to invoke commands. It's not really a language. For example, the shell does not have numeric data types, and addition operations are very complicated. In short, the shell cannot fully mobilize the computer's functions.
(For shell, you can refer to Linux architecture and Linux command line and commands)
Guido hopes to have a language that can fully call the functional interface of the computer like C language, and can also fully call the functional interface of the computer like shell. , can be easily programmed. ABC language gives Guido hope. ABC was developed by CWI (Centrum Wiskunde & Informatica, Mathematics and Computer Research Institute) in the Netherlands. Guido works at CWI and is involved in the development of the ABC language. ABC language is for teaching purposes. Unlike most languages at the time, the goal of the ABC language was to "make users feel better." ABC Language hopes to make the language easy to read, easy to use, easy to remember, and easy to learn, and to stimulate people's interest in learning programming. For example, the following is an ABC program from Wikipedia. This program is used to count the total number of words (Word) appearing in the text:
HOW TO RETURN words document:
PUT {} IN collection
FOR line IN document: N for word in split line:
if word not.in collection:
insert word in collection
return collection
How to
to define a function. A Python programmer should easily understand this program. ABC language uses colon (:) and indentation to represent program blocks (C language uses {} to represent program blocks). There is no semicolon at the end of the line. There are also no parentheses () in the for and if structures. If you change the HOW TO to def, the PUT line to collection = [], and the INSERT line to collection.append(word), this is almost a standard Python function. The function above reads like a natural piece of text.
Despite its good readability and ease of use, the ABC language did not eventually become popular. At that time, the ABC language compiler required a relatively high-end computer to run. The users of these computers are usually computer proficient, and they consider the efficiency of the program more than the difficulty of learning it. In addition to hardware difficulties, the design of the ABC language also has some fatal problems:
Poor scalability. ABC language is not a modular language. If you want to add functions to the ABC language, such as graphical support, you must change many places.
Cannot perform IO directly. ABC language cannot directly operate the file system. Although you can import data through methods such as text streams, ABC cannot read and write files directly. The difficulty of input and output is fatal to computer languages. Can you imagine a sports car with doors that can't be opened?
Excessive innovation. ABC uses natural language to express the meaning of the program, such as HOW TO in the above program. However, for programmers, they are more accustomed to using function or define to define a function. Likewise, programmers are accustomed to using the equal sign (=) to assign variables. Although this makes the ABC language look special, it actually makes it more difficult for programmers to learn (most programmers know more than one language).
Difficulty in spreading. The ABC compiler was large and had to be stored on tape. When Guido visited, he had to have a large tape to install the ABC compiler for others. In this way, it is difficult for ABC language to spread quickly.
IBM tape drive: reading and writing tapes
In 1989, in order to pass the Christmas vacation, Guido started writing a compiler/interpreter for the Python language. Python comes from Guido’s beloved TV series Monty Python’s Flying Circus (a indoor sitcom broadcast by the BBC in the 1960s and 1970s, based on British life at the time). He hopes that this new language called Python can realize his concept (a language between C and shell, full-featured, easy to learn, easy to use, and scalable). As a language design enthusiast, Guido has already made (not very successful) attempts at designing languages. This time, it was nothing more than a pure act of hacking.
The birth of Python
In 1991, the first Python compiler (also an interpreter) was born. It is implemented in C language and can call C libraries (.so files). Since its birth, Python has had: classes, functions, exception handling, core data types including lists and dictionaries, and module-based Expand the system.
Original Python logo: Designed by Guido’s brother Just von Rossum
Many of Python syntax comes from C, but it is also strongly influenced by the ABC language. Some rules from the ABC language are controversial to this day, such as forced indentation. But these syntax rules make Python easy to read. Python, on the other hand, cleverly chooses to obey some conventions (especially those of the C language). For example, use the equal sign to assign values and use def to define functions. Guido believes that if something is established based on "common sense", there is no need to get too hung up on it.
Python has paid special attention to extensibility from the beginning. Python can be extended on multiple levels. At a high level, you can import .py files. Under the hood, you can reference C libraries. Python programmers can quickly use Python to write .py files as expansion modules. But when performance is an important factor to consider, Python programmers can go deep into the bottom layer, write C programs, compile them into .so files and introduce them into Python for use. Python is like building a house with steel. First define the large frame. Programmers can expand or change quite freely under this framework.
The original Python was completely developed by Guido himself. Python is popular among Guido's colleagues. They provide quick feedback and participate in Python improvements. Guido and some colleagues form the core team of Python. They spend most of their free time hacking Python (including work time, since they use Python for work). Subsequently, Python expanded beyond CWI. Python hides many machine-level details and leaves them to the compiler to handle, and highlights logical-level programming thinking. Python programmers can spend more time thinking about the logic of the program rather than the specific implementation details (Guido has a T-shirt that reads: Life is short, I use Python). This feature attracts a large number of programmers. Python became popular.
We have to pause our Python time and take a look at the computer overview at this time. In the early 1990s, personal computers began to enter ordinary households. Intel released the 486 processor, and Windows released a series of window systems starting with window 3.0. Computer performance is greatly improved. Programmers began to pay attention to the ease of use of computers (such as graphical interfaces).
Windows 3.0
As computer performance improves, the world of software begins to change. The hardware is sufficient for many personal computers. Hardware manufacturers are even eager for the emergence of high-demand software to drive upgrading of hardware. C++ and java became popular one after another. C++ and Java provide object-oriented programming paradigms and rich object libraries. At the expense of a certain amount of performance, C++ and Java have greatly improved program output. The ease of use of the language has been taken to a new level. We also remember that an important reason for the failure of ABC was the performance limitations of the hardware. In this respect, Python is much luckier than ABC.
Another change that is happening quietly is the Internet. The 1990s was still the era of personal computers. Windows and Intel dominated the world with PCs, and they were very popular for a while. Although the Internet-based information revolution has not yet arrived, many programmers and experienced computer users are already frequently using the Internet for communication (including email and newsgroups). The Internet has greatly reduced the cost of information exchange. A new software development model is becoming popular: open source. Programmers use their spare time to develop software and open source code. In 1991, Linus released the Linux kernel source code on the comp.os.minix news group, attracting a large number of hackers to join. Linux and GNU work together to form a vibrant open source platform.
Hardware performance is not a bottleneck, and Python is easy to use, so many people are turning to Python. Guido maintains a maillist, and Python users communicate through email. Python users come from many fields, have different backgrounds, and have different needs for Python. Python is quite open and easy to expand, so when users are not satisfied with the existing functions, it is easy to expand or transform Python. These users then send their changes to Guido, who decides whether to add the new features to Python or the standard library. It would be a great honor if the code could be incorporated into Python itself or the standard library. Python itself is better for it.
(Guido had to make many decisions, which is why he is called Benevolent Dictator For Life)
Python is called "Battery Included", which means that it and its standard library are powerful. These are contributions from the entire community. Python developers come from different fields, and they bring the advantages of different fields to Python. For example, regular expressions in the Python standard library refer to Perl, while lambda, map, filter, and reduce functions refer to Lisp. Some features of Python itself and most of the standard library come from the community. The Python community continues to expand and has its own newsgroup, website (python.org), and foundation (Python Software Foundation). Starting from Python 2.0, Python has also changed from a maillist development method to a completely open source development method. A community atmosphere has been formed, work is shared by the entire community, and Python has also achieved faster development.
(Since Guido enjoys absolute arbitration rights, many enthusiasts were quite worried about Guido’s life in the early days of Python’s maillist development. They even made assumptions: What would happen to Python if Guido died. See If Guido was hit by a bus)
Today, the framework of Python has been established. The Python language organizes code with objects as the core (Everything is object), supports multiple programming paradigms (multi-paradigm), uses dynamic typing, and automatically performs memory recycling (garbage collection). Python supports interpreting and can call C libraries for expansion. Python has a powerful standard library (battery included). Since the standard library system has stabilized, the Python ecosystem has begun to expand to third-party packages. These packages, such as Django, web.py, wxpython, numpy, matplotlib, and PIL, upgrade Python into a species-rich tropical rainforest.
Today Python has entered the 3.0 era. Since Python 3.0 is not backwards compatible, the transition from 2.0 to 3.0 is not easy. On the other hand, Python's performance still deserves improvement, and Python's computing performance is lower than C++ and Java (see Google's discussion). Python is still a language in development. I look forward to seeing what the future holds for Python.
Python Revelation
Python advocates elegance, clarity, and simplicity. It is an excellent and widely used language (TIOBE language ranking is eighth, Google's third largest development language, Dropbox's basic language, Douban's server language) . There is no shortage of excellent languages in the world, but the development history of Python, as a representative, has given me a lot of inspiration.
In the development process of Python, the community plays an important role. Guido thinks that he is not an all-round programmer, so he is only responsible for formulating the framework. If the problem is too complicated, he will choose to go around it, that is, cut the corner. These problems are ultimately solved by others in the community. The talent in the community is extremely rich. Even things that are slightly distant from development, such as creating websites and raising funds, there are people who are willing to handle them. Today's project development is becoming more and more complex and larger. Cooperation and an open mind have become the keys to the ultimate success of the project.
Python has learned a lot from other languages, whether it is ABC that has entered history, or C and Perl that are still in use, and many other languages not listed. It can be said that Python's success represents the success of all the languages it draws from. Similarly, Ruby borrows from Python, and its success also represents the success of Python in some aspects. Every language is a hybrid, with its strengths and weaknesses. At the same time, the judgment of "good or bad" of a language is often subject to external factors such as platform, hardware, era, etc. Programmers experience many language battles. I thought, why not distinguish the specific advantages and disadvantages of each language with an open mind and objective analysis, and distinguish between internal and external factors. Maybe one day I will find that a language I don't like contains exactly what I need.
No matter what the future fate of Python is, the history of Python is already an interesting novel.
The above is the content of Python Quick Tutorial (Supplement 04): A Brief History of Python. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!