Python is my favorite language, simple, graceful and easy to use. Two days ago, I was passionate about the benefits of Python to my friends.
"Well, I admit Python's good, but why is it called Python?" ”
"Well, it seems to be the name of a TV show." ”
"Are you saying that Guido is an American?" ”
"He switched from Google to Dropbox work, but his name was Dutch." ”
"Are you sure you are familiar with Python?" ”
So for revenge, I took the time to investigate Python's history. I've seen the origins of many of the features in Python and Python's design philosophy, and I've seen the evolution of a programming language, and I've seen a fascinating connection between Python and the open source movement. From the history of Python, we can glimpse the ideas and achievements of open source development.
This can also be a preface to my Python quick tutorial.
Origin
The author of Python, Guido von Rossum, is indeed a Dutch man. Guido obtained a master's degree in mathematics and computer from the University of Amsterdam in 1982. However, although he is a mathematician, he enjoys the fun of computers. In his words, despite his math and computer credentials, he tends to do computer-related work and is keen to do anything related to programming.
At that time, Guido contacted and used languages such as Pascal, C, and Fortran. The basic design principle of these languages is to enable the machine to run faster. In the 80 's, although IBM and Apple had set off a wave of personal computers, the configuration of these PCs was low. For example, early Macintosh, only 8MHz CPU frequency and 128KB RAM, a large array can fill up the memory. The core of all compilers is to do optimizations so that programs can run. To improve efficiency, language also forces programmers to think like computers so that they can write more machine-flavored programs. In those days, programmers wanted to squeeze every inch of the computer's ability with their hands. Some people even think that the C-language pointer is wasting memory. As for dynamic type, automatic memory management, object-oriented ... Don't think about it, it will paralyze your computer.
This way of programming makes Guido feel distressed. Guido knows how to write a feature in C, but the whole process takes a lot of time, even if he knows exactly how to implement it. Another option for him is the shell. The Bourne shell has long existed as an interpreter for UNIX systems. UNIX administrators often use the shell to write simple scripts for some system maintenance tasks, such as regular backups, file system management, and so on. The shell can be like glue, connecting many functions under UNIX. In many C languages, hundreds of lines of programs can be done in just a few lines under the shell. The essence of the shell, however, is to invoke the command. It's not really a language. For example, the shell has no numeric data type, and the addition operation is complex. In short, the shell does not fully mobilize the functions of the computer.
Guido wants to have a language that, like C, can fully invoke the functional interface of a computer, and can be programmed as easily as a shell. ABC language lets Guido see hope. ABC was developed by the Dutch Institute of Mathematics and Computer science. Guido works at the Institute and participates in the development of the ABC language. The ABC language is intended for teaching purposes. Unlike most languages at the time, the goal of the ABC language was to "make the user feel better". ABC language wants to make language easy to read, easy to use, easy to remember, easy to learn, and to stimulate people's interest in learning programming. For example, here is a section of ABC program from Wikipedia, which is used to count the total number of words appearing in the text:
Copy Code code as follows:
How to return words document:
Put {} in collection
For line in document:
For word in the split line:
IF Word not.in Collection:
INSERT Word in Collection
Return collection
How to defines a function. A python programmer should be very easy to understand this program. The ABC language uses colons and indents to represent the program block. There is no semicolon at the end of the line. There is also no bracket () in the for and if structure. The assignment takes the put, not the more common equals sign. These changes allow the ABC program to read like a piece of text.
Despite the good readability and ease of use, the ABC language was not in vogue. At the time, the ABC language compiler needed a more highly configured computer to run. Users of these computers, who are usually proficient in computers, are more concerned with the efficiency of the program than the difficulty of learning it. In addition to hardware difficulties, there are some fatal problems with the design of the ABC language:
Scalability is poor. The ABC language 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 of places.
IO cannot be done directly. The ABC language cannot directly manipulate file systems. Although you can import data by way of text flow, ABC cannot read and write files directly. The difficulty of input and output is fatal to the computer language. Can you imagine a sports car that can't open the door?
Over innovation. ABC uses natural language to express the meaning of the program, such as how to in the program above. For programmers, however, they are more accustomed to defining a function with functions or define. Similarly, programmers are more accustomed to assigning variables with equal signs. Although ABC language is very special, it is very difficult to learn.
Communication difficulties. The ABC compiler is large and must be saved on tape. When Guido was visiting, it was necessary to have a great magnetism to bring the ABC compiler to others. In this way, ABC language is very difficult to spread quickly.
In 1989, in order to pass the Christmas holiday, Guido began writing the Python language compiler. The name Python comes from Guido's beloved TV series Monty Python's Flying Circus. He hopes the new language, called Python, fits his vision: to create a language that is comprehensive, easy to learn, and extensible, between C and Shell. Guido, as a language design enthusiast, has already tried to design a language. This time, it is only a pure hacking behavior.
The birth of a language
The first Python compiler was born in 1991. It is implemented in C language and can call library files in C language. From birth, Python already has: classes, functions, exception handling, core data types including tables and dictionaries, and modular expansion systems.
Many python grammars come from C, but are strongly influenced by the ABC language. Some of the rules from the ABC language have until today been controversial, such as forced indentation. But these grammatical rules make python easy to read. On the other hand, Python's smart choice is to follow some conventions, especially the C-language conventions, such as returning equal-value assignments. Guido that, if the "common sense" on the establishment of things, there is no need for excessive entanglement.
Python has been particularly concerned with scalability from the outset. Python can be expanded at multiple levels. From the top, you can introduce the. py file directly. At the bottom, you can refer to the C language library. Python programmers can quickly use Python to write the. py file as an extension module. But when performance is an important factor to consider, Python programmers can drill down into the bottom, write a C program, and compile it into Python using the. so file. Python is like using a steel building to set up a big frame first. And programmers can be 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 feedback the use of comments and participate in the improvement of Python. Guido and some colleagues form the core team of Python. They spend most of their spare time hack Python. Later, Python expanded beyond the Institute. Python hides the details at many machine levels and gives it to the compiler to deal with it, highlighting the logical aspects of programmatic thinking. Python programmers can spend more time thinking about the logic of the program than the specifics of the implementation. This feature attracts a large number of programmers. Python is starting to pop.
Life is short, I use Python
The Times create the hero
We had to pause our Python time and look at the rapidly changing computer industry. At the beginning of the 1990, the PC began to enter the ordinary family. Intel has released 486 processors, and Windows publishes a series of Windows 3.0 starts. The performance of the computer is greatly improved. Programmers are starting to focus on the ease of use of computers, such as graphical interfaces.
Windows 3.0
The world of software has also begun to change as computer performance improves. The hardware is sufficient to meet the needs of many PCs. Hardware manufacturers are even eager for the emergence of high demand software to drive hardware upgrades. C + + and Java are popular in succession. C + + and Java provide an object-oriented programming paradigm, as well as a rich library of objects. C + + and Java have greatly increased the production of programs at the expense of certain performance. The ease of language is mentioned as a new height. As we recall, one important reason for ABC failure is the performance limitations of the hardware. In this respect, Python is much luckier than ABC.
Another change that's quietly happening is the Internet. In the 1990 's or PC era, Windows and Intel had PCs to make the world flourished. Although the Internet-oriented information revolution has not yet arrived, many programmers and senior computer users have been using the Internet frequently for communication, such as email and newsgroup. The internet has greatly reduced the cost of communicating information. A new software development model has become popular: open source. Programmers use their spare time to develop software and open the source code. In 1991, Linus the Linux kernel source code on the Comp.os.minix newsgroup, attracting a large number of hacker to join. Linux and GNU work together to eventually form a vibrant open source platform.
Hardware performance is not a bottleneck and Python is easy to use, so many people are starting 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 it's easy to expand or transform Python when users are not content with existing functionality. These users then send the changes to Guido and the Guido decides whether to add the new features to Python or the standard library. This would be a great honor if the code could be incorporated into Python itself or the standard library. Because of Guido's supreme power of decision, he was thus called "a benevolent dictator of life".
Python is known as the "Battery Included", which is a powerful feature of its standard library. These are the contributions of the entire community. Python's developers come from different fields, and they bring the benefits of different areas to python. For example, regular expressions in the Python standard library refer to Perl, whereas the lambda, map, filter, and reduce functions refer to Lisp. Some of the features of Python itself and most of the standard libraries come from the community. The python community is expanding to have its own newsgroup, web sites, and funds. Starting with Python 2.0, Python has also shifted from a maillist development approach to a fully open source development approach. Community atmosphere has been formed, work is shared by the whole community, Python has also been more rapid development.
To this day, the Python framework has been established. The Python language takes object as the core organization code, supports a variety of programming paradigm, adopts dynamic type, and automatically reclaims memory. Python supports interpretation operations and can call C libraries for expansion. Python has a powerful library of standards. As the standard library system has stabilized, Python's ecosystem has begun to expand to third-party packages. These packages, such as Django, web.py, Wxpython, NumPy, Matplotlib, and PiL, have upgraded python to a species-rich rainforest.
Revelation
Python advocates beauty, clarity and simplicity, and is an excellent and widely used language. Python ranks eighth in the Tiobe rankings, which is Google's third-largest development language, Dropbox's basic language, and Watercress's server language. The history of Python can be a representative and bring me a lot of inspiration.
In the Python development process, the Community played an important role. Guido thinks he's not a versatile programmer, so he's only responsible for framing. If the problem is too complicated, he will choose to go around, cut the corner. These problems are ultimately addressed by other people in the community. The talent in the community is exceptionally rich, and even the creation of a Web site to raise funds so far from the development of things, there are people willing to deal with. Today's project development is becoming more complex, more and more large, cooperation and open mind become the key to the ultimate success of the project.
Python has learned a lot from other languages, whether it's the ABC that has entered history, the C and Perl that 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. Similarly, Ruby has borrowed from Python, and its success also represents some of the successes of Python. Every language is a mixture, there are good places, but there are all kinds of defects. At the same time, a language "good and bad" judgment, often subject to the platform, hardware, times and other external reasons. Programmers have been through a lot of language battles. In fact, with an open mind to accept each language, perhaps one day, programmers can also like Guido, mixed out their own language.
Whatever the fate of Python's future, Python's history is an interesting novel.