Origin
The author of Python, Guido von Rossum, the Dutchman. Guido received a master's degree in mathematics and computer Science from the University of Amsterdam in 1982. However, even though he is a mathematician, he enjoys the pleasure of computer. In his words, despite his mathematical and computer credentials, he tends to do computer-related work and is passionate about doing anything and programming.
At that time, Guido contacted and used languages such as Pascal, C, and Fortran. The basic design principles of these languages are to allow machines to run faster. In the 80 's, although IBM and Apple have set off a wave of personal computers, the configuration of these PCs is low. For example, the early Macintosh, only 8MHz CPU frequency and 128KB of RAM, a large array can fill the memory. The core of all compilers is to do optimizations so that the program can run. To improve efficiency, language also forces programmers to think like computers so that they can write programs that are more machine-flavored. 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 types, memory auto-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 function in C, but the whole writing 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 to perform some system maintenance tasks, such as regular backups, file system management, and so on. The shell can connect many of the features under UNIX, just like glue. Many of the C-language hundred lines of the program, under the shell only a few lines can be completed. However, the nature of the shell is to invoke the command. It's not a real 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 function of the computer.
Guido wants to have a language that, like the C language, can fully invoke a computer's functional interface, and can be easily programmed like a shell. ABC language let Guido see hope. ABC was developed by the Dutch Institute of Mathematics and Computer science. Guido worked at the institute and was involved in the development of the ABC language. The ABC language is aimed at teaching. Unlike most languages at the time, the goal of the ABC language is to "make users feel Better". ABC language wants to make language easy to read, easy to use, easy to remember, easy to learn, and to inspire people to learn programming interest. For example, here is an ABC program from Wikipedia, which is used to count the total number of words that appear in the text:
How to RETURN words Document:put {} In collection to line in Document:for word in Split line:if word not.in Collection:insert word in collection RETURN Collection
How to defines a function. A Python programmer should be able to understand this program very easily. 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 parentheses () in the for and if structures. The assignment takes a put instead of a more common equals sign. These changes make the ABC program read like a piece of text. Despite the good readability and ease of use, the ABC language was not in vogue at the end. At the time, the ABC language compiler needed a high-profile computer to run. 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 hardware difficulties, the design of the ABC language has some fatal problems: poor scalability. The ABC language is not a modular language. If you want to add functionality to the ABC language, such as graphical support, you have to change a lot of places. IO cannot be done directly. The ABC language cannot directly manipulate the file system. Although you can import data in a way such as text flow, ABC cannot read and write files directly. The difficulty of input and output is fatal for 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 above program. For programmers, however, they are more accustomed to using functions or define to define a function. Similarly, programmers are more accustomed to assigning variables with equal signs. Although the ABC language is very special, it is very difficult to learn. Transmission difficulties. The ABC compiler is large and must be stored on tape. When Guido was visiting, it was necessary to have a large magnet brought to someone to install the ABC compiler. In this way, the ABC language is difficult to spread quickly. In 1989, in order to pass the Christmas holiday, Guido began to write the Python language compiler. The name Python, from Guido's beloved TV show Monty Python's Flying Circus. He hoped that the new language, called Python, would fit his ideals: create a language that is all-powerful, easy to learn, easy to use, and extensible, between C and Shell. As a language design enthusiast, Guido has tried to design the language. This time, it was just a purely hacking act.
The birth of a language
1991, the first Python compiler was born. It is implemented in C language and can call the C language library file. From birth, Python already has: classes, functions, exception handling, core data types including tables and dictionaries, and module-based expansion systems. Many of the python grammars come from C, but are strongly influenced by the ABC language. Some of the rules from the ABC language are still controversial today, such as forced indentation. But these syntax rules make python easy to read. On the other hand, Python's clever choices obey some conventions, especially those of the C language, such as the return equal value assignment. Guido that if the "common sense" on the establishment of things, there is no need to over-tangled. Python has been particularly concerned about extensibility from the start. Python can be expanded on multiple levels. From the top, you can introduce directly. PY file. At the bottom, you can reference the C-language library. Python programmers can write quickly using Python. PY file as an extension module. But when performance is an important factor to consider, Python programmers can drill down to the bottom, write C programs, and compile into. So files for use in Python. Python is like a steel building, with a large frame set up first. And programmers can be quite free to expand or change in this framework. The original python was developed entirely by Guido himself. Python has been welcomed by Guido colleagues. They quickly feedback the use of comments and participate in Python improvements. Guido and some colleagues form the core team of Python. They used most of their spare time to hack Python. Later, Python expanded beyond the Institute. Python hides many of the details at the machine level, handing it over to the compiler, and highlighting logic-level programming 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 getting popular.
Life is short, I use python!
The Times Create Heroes
We had to pause our Python time and take a look at the ever-changing computer industry. In the early 1990, the PC began to enter the ordinary family. Intel released 486 processors, and Windows released a series of windowing systems starting with Window 3.0. The performance of the computer is greatly improved. The programmer began to focus on the ease of use of the computer, compared to the form of interface.
Windows 3.0
With the improvement of computer performance, the world of software has also begun to change. The hardware is sufficient to meet the needs of many PCs. Hardware vendors are even eager for 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. At the expense of a certain performance, C + + and Java greatly increase the output of the program. The ease of language is referred to as a new height. As we recall, 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 quietly happens is the internet. The 1990 's was the era of personal computers, with Windows and Intel carrying PCs to make the world flourished. Although the Internet-centric information revolution has yet to come, many programmers and veteran computer users have been using the Internet for frequent communication, such as using email and newsgroup. The internet has greatly reduced the cost of information exchange. A new model of software development has become popular: open source. Programmers use their spare time to develop software and open the source code. In 1991, Linus released the Linux kernel source code on the Comp.os.minix News group, attracting a large number of hacker 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 start turning to Python. Guido maintains a Maillist,python user to communicate via email. Python users come from many fields, have different backgrounds, and have different needs for python. Python is fairly open and easy to expand, so it's easy to expand or transform Python when the user isn't satisfied with the existing functionality. These users then send the changes to Guido, and the Gu Ido decides whether to add the new feature 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 the supreme decision of Guido, he was called the "Benevolent dictator of Life". Python, known as "Battery Included", is a powerful feature of its standard library. These are the contributions of the Community as a whole. Python's developers come from a variety of fields, and they bring the benefits of different areas to python. For example, the regular expressions in the Python standard library refer to Perl, while 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 continues to expand, thus owning its own newsgroup, website, toand funds. Starting with Python 2.0, Python has also shifted from Maillist's development approach to fully open source development. Community atmosphere has been formed, work is shared by the entire community, Python has also been more rapid development. To this day, the Python framework has been established. The Python language organizes code with objects as its core, supports multiple programming paradigms, and uses dynamic types to automate memory recovery. Python supports interpretation runs and can call the C library for expansion. Python has a strong standard library. As the standard library system is stable, the Python ecosystem begins 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 is beautiful, clear and simple, and is an excellent and widely used language. Python ranked eighth in the Tiobe rankings, Google's third-largest development language, Dropbox's base language, and Watercress's server language. The history of Python can serve as a representative and give me a lot of revelation. The community has played an important role in Python's development process. Guido thinks he is not an all-powerful programmer, so he is only responsible for framing. If the problem is too complicated, he will choose to go around, that is, cut the corner. These issues are ultimately addressed by others in the community. The people in the community are exceptionally rich, and even creating a website, raising funds and so on with the development of something far away, there are people willing to deal with. Today's project development is becoming more complex, larger, more collaborative, and open-minded as 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 the history, or the C and Perl that are still in use, and many other languages that are not listed. It can be said that Python's success represents the success of all the languages it draws upon. Similarly, Ruby draws on Python, and its success also represents some aspects of Python's success. Every language is a mixture, has its excellent place, but also has a variety of defects. At the same time, a language "good and bad" judgment, often constrained by the platform, hardware, the Times and so on external reasons. Programmers have been through a lot of language battles. In fact, with an open mind to accept the language, perhaps one day, the programmer can also be as Guido as a mixture of their own language.
- Key points of common sense
- The pronunciation and spelling of Python
- Python means Python, from a TV show that the author likes (c?). )
- The author of Python is Guido van Rossum (Uncle Tortoise)
- Python is a programming language written by Uncle Turtle in C during the Christmas of 1989, in order to kill a boring Christmas.
- Python was formally born in 1991
- Python's interpreter is now available in several languages, and we often use CPython (the official version of the C language implementation), as well as Jython (which can run on the Java platform), IronPython (which can run on the. NET and mono platforms), PyPy (Python-enabled, JIT-on-the-fly compilation)
- Python currently has two versions, Python2 and Python3, and the latest editions are 2.7.12 and 3.5.2, and most companies use Python2 at this stage.
- Life are shot, you need Python. Life is short, I use Python.
- January 2017 popular ranking of programming languages
-
2. Python pros and consAdvantages
Simple ———— Python is a language that represents the idea of simplicity. Reading a good Python program feels like reading English, even though the requirements of this English are very strict! This pseudo-code nature of Python is one of its greatest advantages. It allows you to focus on solving problems rather than figuring out the language itself.
Easy to learn ———— as you will see, Python is extremely easy to get started with. As mentioned earlier, Python has a very simple syntax.
Free, open source ———— python is one of floss (free/open source software). Simply put, you are free to publish a copy of the software, read its source code, make changes to it, and use it as part of the new free software. Floss is the concept of sharing knowledge based on a group. That's one of the reasons why Python is so good-it's created and constantly improved by a group of people who want to see a better python.
High-level language ———— when you write programs in the Python language, you don't have to consider the underlying details such as how to manage the memory that your program uses.
Portability ———— because of its open source nature, Python has been ported on many platforms (modified to make it work on different platforms). If you are careful to avoid using system-dependent features, all your Python programs can run without modification on any of the platforms listed below. These platforms include Linux, Windows, FreeBSD, Macintosh, Solaris, OS/2, Amiga, AROS, as/400, BeOS, os/390, z/OS, Palm OS, QNX, VMS, Psion, Acom RISC OS, VxWorks, PlayStation, sharp Zaurus, Windows CE and even PocketPC, Symbian, and Google Linux-based Android platforms!
Explanatory ———— This requires some explanation. A program written in a compiled language, such as C or C + +, can be converted from a source file (that is, C or C + +) to a language used by your computer (binary code, 0 and 1). This process is done through the compiler and different tags and options. When you run your program, the connection/reprint software copies your program from the hard disk into memory and runs. Programs written in the Python language do not need to be compiled into binary code. You can run the program directly from the source code. Inside the computer, the Python interpreter translates the source code into an intermediate form called bytecode, and then translates it into the machine language used by the computer and runs it. In fact, because you no longer need to worry about how to compile the program, how to make sure that the connection is reprinted with the correct library, and so on, all this makes using Python easier. Since you only need to copy your Python program to another computer, it will work, which makes your Python program easier to migrate.
Object-oriented ———— Python supports both process-oriented programming and object-oriented programming. In a "process-oriented" language, a program is built from a procedure or simply a function of reusable code. In "Object-oriented" languages, programs are built from objects that combine data and functionality. Python implements object-oriented programming in a very powerful and simple way, compared to other major languages such as C + + and Java.
Scalability ———— If you need a piece of your critical code to run faster or you want some algorithms to be private, you can write some of your programs in C or C + + and then use them in your Python program.
The rich library ———— Python standard library is really huge. It can help you with all kinds of work, including regular expressions, document generation, unit tests, threads, databases, Web browsers, CGI, FTP, e-mail, XML, XML-RPC, HTML, WAV files, cryptography systems, GUI (graphical user interface), TK, and other system-related operations. Remember that all of these features are available as long as Python is installed. This is called Python's "fully functional" concept. In addition to the standard library, there are many other high-quality libraries, such as Wxpython, twisted, and Python image libraries, and so on.
Canonical code ———— python uses forced indentation to make the code extremely readable.
Disadvantages
- Speed, speed requirements, use C + + to rewrite the key part of it.
- The domestic market is small (the main development of Python in China, currently only some web2.0 companies). But time goes by, now many domestic software companies, especially game companies, are also beginning to scale using him.
- Chinese information is scarce (good python is a handful of Chinese data). The blessing of the community, there are several excellent teaching materials have been translated, but the entry-level teaching materials, high-level content can only read English version.
- There is too much choice in architecture (there is no official. NET architecture like C #, nor is the relative concentration of architecture developed as Ruby because of its short history. Ruby on Rails architecture to develop small and medium web programs invincible. But it also shows from another side that Python is excellent, attracts more people and has more projects.
3. Python Application Scenario
Web application Development
Python is often used for web development. For example, with the Mod_wsgi module, Apache can run web programs written in Python. Python defines the WSGI standard application interface to coordinate the communication between the HTTP server and the Python-based Web program. Some web frameworks, such as django,turbogears,web2py,zope, can make it easy for programmers to develop and manage complex web programs.
Operating System Management, server operations Automation scripts
In many operating systems, Python is the standard system component. Most Linux distributions, as well as NetBSD, OpenBSD, and Mac OS X, are integrated with Python and can be run directly under the terminal. Some installers for Linux distributions are written in the Python language, such as the Ubuntu ubiquity Installer, Red Hat Linux, and Fedora's Anaconda installer. Gentoo Linux uses Python to write its Portage package management system. The Python standard library contains multiple libraries that invoke operating system functionality. By Pywin32 This third-party package, Python has access to Windows COM services and other Windows APIs. Use the Ironpython,python program to directly invoke the. Net Framework. In general, the system management scripts written by Python are superior to normal shell scripts in terms of readability, performance, code reuse, and extensibility.
Scientific calculations
Numpy,scipy,matplotlib allows Python programmers to write scientific computing programs.
Desktop software
PyQt, Pyside, WxPython, and PYGTK are a powerful tool for Python to rapidly develop desktop applications.
Server Software (network software)
Python's support for various network protocols is perfect, so it is often used to write server software and web crawlers. The third-party library twisted supports asynchronous network programming and most standard network protocols (including clients and servers), and provides a variety of tools that are widely used to write high-performance server software.
Game
Many games use C + + to write high-performance modules such as graphical display, while using Python or Lua to write game logic, servers. Compared to Python,lua, the functionality is simpler and smaller, while Python supports more features and data types.
Concept implementation, early prototyping and iteration of the product
YouTube, Google, Yahoo!, and NASA all use Python in their own way.
1.1 Understanding Python (Learn)