In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The main content of this article is to explain how Python was born. Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how Python was born.
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 computer science from the University of Amsterdam (University of Amsterdam). However, although he is a mathematician, he enjoys the fun of computers more. In his words, despite his qualifications in both math and computer science, he always tends to do computer-related work and is keen to do anything related to programming.
At that time, he came into contact with and used languages such as Pascal, C, Fortran and so on. The basic design principle of these languages is to make the machine run faster. In the 1980s, although IBM and Apple made a wave of personal computers, the configuration of these personal computers was very low (in today's view). For example, in the early Macintosh, only 8MHz's CPU main frequency and 128KB's RAM, a large array can fill up memory. The core of all compilers is to optimize so that the program can run. In order to improve efficiency, language also forces programmers to think like computers so that they can write programs that better suit machine tastes. At that time, programmers wanted to squeeze every inch of the computer with their hands. Some people even think that C language pointers are a waste of memory. As for dynamic types, automatic memory management, object-oriented... Forget it, it will paralyze your computer.
However, this way of thinking bothers Guido. Guido knows how to write a function in C, but the whole writing process takes a lot of time (even if he already knows exactly how to implement it). His other option is shell. Bourne Shell has been the interpreter (interpreter) of UNIX system for a long time. UNIX administrators often use shell to write simple scripts for system maintenance, such as regular backups, file system management, and so on. Shell can be like glue, connecting many functions under UNIX together. Many programs with hundreds of lines in C can be completed in only a few lines under shell. However, the essence of shell is to invoke commands. It's not a real language. For example, shell does not have numeric data types, and addition operations are complex. In short, shell can not fully mobilize the functions of the computer.
(for shell, you can refer to the Linux architecture and Linux command line and commands)
Guido hopes to have a language that, like C, can fully invoke the functional interface of the computer, and can be programmed easily like shell. The ABC language gives Guido hope. ABC was developed by CWI (Centrum Wiskunde & Informatica, Institute of Mathematics and computer) in the Netherlands. Guido works at CWI and is involved in the development of the ABC language. ABC language is for the purpose of teaching. Unlike most languages at the time, the goal of the ABC language was to "make users feel better". The ABC language hopes to make the language easy to read, easy to use, easy to remember and easy to learn, so as to stimulate people's interest in learning programming. For example, here is an ABC program from Wikipedia that counts the total number of words (word) that appear in the text:
HOW TO RETURN words document: PUT {} IN collection FOR line IN document: FOR word IN split line: IF word not.in collection: INSERT word IN collection RETURN collection
HOW TO is used to define a function. This program should be easily understood by a Python programmer. The ABC language uses colons (:) and indentation to indicate blocks (C uses {} to denote 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 HOW TO to def, change the PUT line to collection = [], and change the INSERT line to collection.append (word), this is almost a standard Python function. The above function reads like a natural text.
Despite its good readability and ease of use, the ABC language did not become popular in the end. At that time, the ABC language compiler required a higher configuration of the computer to run. The users of these computers are usually proficient in computers, and they think more about the efficiency of the program than the difficulty of learning it. In addition to the hardware difficulties, there are also some fatal problems in the design of the ABC language:
The extensibility is poor. ABC is not a modular language. If you want to add functionality to the ABC language, such as support for graphics, you have to change a lot.
IO cannot be done directly. The ABC language cannot directly manipulate 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 language. Can you imagine a sports car that can't open the door?
Excessive innovation. ABC expresses the meaning of the program in a natural language, such as HOW TO (how) in the above program. For programmers, however, they are more used to using function or define to define a function. Similarly, programmers are used to assigning variables with an equal sign (=). While this makes the ABC language special, it actually makes it harder for programmers to learn (programmers mostly master more than one language).
It is difficult to spread. The ABC compiler is very large and must be saved on tape (tape). At that time, when Guido was accessed, it was necessary to have a large magnetic tape for others to install the ABC compiler. In this way, it is difficult for ABC language to spread quickly.
IBM tape drive: read and write tapes
In 1989, to spend the Christmas holiday, Guido began to write a compiler / interpreter for the Python language. Python comes from Guido's beloved TV series Monty Python's Flying Circus (BBC1960-1970s indoor sitcom based on British life at that time). He hopes that the new language, called Python, will realize his idea (a fully functional, easy-to-learn, extensible language between C and shell). Guido, as a language design enthusiast, has made (not very successful) attempts to design languages. This time, it is only a pure hacking behavior.
The birth of Python
In 1991, the first Python compiler (and interpreter) was born. It is implemented in C language and can call C library (.so file). From birth, Python has had classes (class), functions (function), exception handling (exception), core data types including tables (list) and dictionaries (dictionary), and module-based extension systems (module).
The original Python logo: designed by Guido's brother Just von Rossum
A lot of Python syntax comes from C, but it is strongly influenced by ABC language. Some rules from the ABC language are still controversial to this day, such as forced indentation. But these grammatical rules make Python easy to read. On the other hand, Python wisely chooses to obey some conventions (especially the conventions 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 in "common sense", there is no need to get too tangled up.
Python has been particularly concerned about extensibility from the very beginning. Python can be extended at many levels. At a high level, you can introduce .py files. At the bottom, you can reference the library of the C language. Python programmers can quickly use Python to write .py files as extension modules. But when performance is an important consideration, Python programmers can go deep into the bottom, write C programs, compile them into .so files and introduce them into Python. Python is like building a house out of steel, defining a large frame first. Programmers are quite free to expand or change under this framework.
The original Python was developed entirely by Guido himself. Python was welcomed by Guido colleagues. They quickly give feedback on how to use it and participate in the improvement of Python. Guido and some of his colleagues form the core team of Python. They spend most of their spare time on hack Python (including working time, because they use Python for work). Subsequently, Python extends beyond CWI. Python hides many details at the machine level to the compiler and highlights the programming thinking at the logical level. Python programmers can spend more time thinking about the logic of the program than the implementation details (Guido has a T-shirt that reads: life is short, I use Python). This feature attracts a large number of programmers. Python is becoming popular.
We had to pause our Python time and take a look at the computer profile at this time. In the early 1990s, personal computers began to enter ordinary homes. Intel released the 486 processor, and windows released a series of Windows systems starting with window 3.0. The performance of the computer has been greatly improved. Programmers began to pay attention to the ease of use of computers (such as graphical interfaces).
Windows 3.0
Due to the improvement of computer performance, the world of software begins to change. The hardware is sufficient to meet the needs of many personal computers. Hardware manufacturers even yearn for the emergence of high-demand software to drive the upgrading of hardware. C++ and Java are popular one after another. C++ and Java provide object-oriented programming paradigms, as well as rich object libraries. At the expense of some performance, C++ and Java greatly increase the output of the program. The ease of use of the language has been raised to a new level. We also remember that an important reason for ABC failure is the performance limitations of the hardware. In this respect, Python is much luckier than ABC.
Another change that has taken place quietly is Internet. The 1990s was still the age of personal computers, when windows and Intel blackmailed PC to make the world flourish. Although the information revolution dominated by Internet has not yet arrived, many programmers and experienced computer users are already using Internet to communicate frequently (including email and newsgroup). Internet has greatly reduced the cost of information exchange. A new software development model becomes popular: open source (open source). Programmers use their spare time to develop software and open source code. In 1991, Linus released the source code of the Linux kernel on the comp.os.minix newsgroup, attracting a large number of hacker. 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 begin to turn to Python. Guido maintains a maillist,Python user to communicate via email. Python users come from many fields, have different backgrounds, and have different requirements 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 the changes to Guido, and it is up to Guido to decide whether to add 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 has become better as a result.
(Guido has to make a lot of 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 the contributions of the entire community. The developers of Python come from different fields, and they bring the advantages of different areas to Python. For example, the regular expression (regular expression) in the Python standard library refers to Perl, while the lambda, map, filter, and reduce functions refer to Lisp. Some of the functions of Python itself and most of the standard libraries come from the community. Python's community is growing, leading to its own newsgroup, website (python.org), and fund (Python Software Foundation). Since Python 2.0, Python has changed from maillist development to completely open source development. The community atmosphere has been formed, the work is shared by the whole community, and Python has achieved more rapid development.
Because Guido has absolute arbitration power, in the early maillist development era of Python, many enthusiasts were quite worried about Guido's life. They even make assumptions about what will happen to Python if Guido dies. See If Guido was hit by a bus)
Today, the framework of Python has been established. Python language organizes code (Everything is object) with objects as its core, supports multiple programming paradigms (multi-paradigm), adopts dynamic typing (dynamic typing), and automatically reclaims memory (garbage collection). Python supports interpretive operation (interpret) and can be extended by calling the C library. Python has a powerful standard library (battery included). As the standard library system has been stable, so the ecosystem of Python began to expand to third-party packages. These packages, such as Django, web.py, wxpython, numpy, matplotlib,PIL, upgrade Python into a species-rich rainforest.
Today, Python has entered the era of 3.0. The transition from 2. 0 to 3. 0 is not easy because of the backward incompatibility of Python 3.0. On the other hand, the performance of Python is still worth improving, and the computing performance of Python lags behind that of C++ and Java (see Google discussion). Python is still a developing language. I look forward to seeing the future of Python.
Python Apocalypse
Python advocates elegance, clarity and simplicity, and is an excellent and widely used language (TIOBE ranks eighth, Google's third largest development language, Dropbox's basic language, Douban's server language). There is no shortage of excellent languages in this world, but the development history of Python, as a representative, has brought me a lot of enlightenment.
The community plays an important role in the development of Python. Guido thinks he is not a versatile programmer, so he is only responsible for making frameworks. 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. There are so many talented people in the community that some people are willing to deal with things that are a little far away from development, such as creating websites and raising funds. Today's project development is becoming more and more complex and large. Cooperation and an open mind have become the key to the ultimate success of the project.
Python has learned a lot from other languages, whether it's ABC, which is already in history, C and Perl, which are still in use, and many other languages that are not listed. It can be said that the success of Python represents the success of all the languages it borrows from. Similarly, Ruby borrows from Python, and its success also represents the success of some aspects of Python. Every language is a hybrid and has its advantages, but it also has all kinds of defects. At the same time, the judgment of a language "good or bad" is often subject to external reasons such as platform, hardware, times and so on. Programmers have experienced many language battles. I think, why not with an open mind and objective analysis, to distinguish the specific advantages and disadvantages of each language, to distinguish between internal and external factors. One day I may find that a language I don't like contains what I need.
At this point, I believe you have a deeper understanding of "how Python was born". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.