I. History of Python development
The Python language, because of its concise and clear style, has a wide range of well-used libraries and open-source frameworks for Python that are popular with many it communities. The origin of Python and the history of how it is, let's take a brief look below.
Traced to the origins of the Python language, it was developed from the early 1990s by Guido van Rossum, in Amsterdam, to develop a new scripting interpreter. I wonder if Guido had ever thought that Python would someday become one of the most popular programming languages?
Some people like to use the glue language to describe Python, because it can easily combine many other language modules, as far as the process is not much to say, if you are interested in anywhere can be found. To know, many universities at home and abroad have also made the Python language as a compulsory course to learn, and the domestic use of Python language to work in the number of units is also increasing, Python programmers are hot ah.
Ask friends who have learned the language of Python, what are some of the attractive places? Most people would think that it is an easy-to-use, easy-to-read and easy-to-maintain language, so there will be a lot of users like using and learning, it is really a widely used language.
The most basic syntax for the Python language is indentation, control statements, expressions, functions, object methods, types, and mathematical operations. Only after learning the basic syntax of Python can we begin the formal application of learning, such as: graphics processing, math processing, Text processing, database, Web programming, crawler and so on practical application.
Python 3.3 is the most current version, but many people prefer to start with Python 2. Because we've talked about it before. The third-party support of Python 3 is not perfect, the learning process will encounter inexplicable problems. It's better to start learning from the already well-developed Python 2. It's also easy to transition to Python 3.
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.
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 advocates beauty, clarity and simplicity, 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.
Ii. advantages and disadvantages of Python
Advantages
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.
Third, 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.
conceived implementations, early prototypes and iterations of the product
YouTube, Google, Yahoo!, and NASA all use Python extensively internally.