Python brief introduction Linux architecture Linux Command Line and command

Source: Internet
Author: User

Author: vamei Source: http://www.cnblogs.com/vamei welcome reprint, please also keep this statement. Thank you!

 

Python is a simple, elegant, and easy to use language. Two days ago, I was excited about the benefits of python to my friends.

After hearing this, my friend asked me: Okay, I admit that python is good, but why is it called Python?

I'm not sure: Well, it seems like the name of a TV series.

My friend asked: Are you talking about Guido as an American? (Guido von rosum, author of Python)

I'm not sure again: he switched from Google to Dropbox, but his name is like Dutch (there is a Von in the middle ).

 

So later I spent some time investigating the history of Python. This is a good learning. I have seen the sources of many functions in Python and the design concepts of Python. For example, what functions are left behind by history, what functions are repeated, and how to add functions ...... In addition, python is also a successful case of the open source movement. From the history of Python, we can look at the concepts and achievements of open-source development.

This can also be written by me.Python quick tutorial.

 

Python Origin

The author of Python, Guido von rosum, is indeed a Dutch. In 1982, Guido received a master's degree in mathematics and computer from the University of Amsterdam. However, although he is a mathematician, he enjoys the pleasure of computer. In his words, despite his mathematics and computer dual-material qualifications, he tends to do computer-related work and is keen to do any programming-related work.

Guido von rosum

At that time, he was familiar with and used languages such as Pascal, C, and FORTRAN. The basic design principle of these languages is to make machines run faster. In 1980s, although IBM and Apple had already set off a wave of PCs, their configurations were very low (in today's opinion ). For example, for the early Macintosh, only 8 MHz CPU clock speed and kB RAM, a large array can occupy full memory. The core of all compilers is to make optimizations so thatProgramCan run. To improve efficiency, the language also forces programmers to think like computers in order to write programs that better suit machine tastes. In that era, programmers were reluctant to extract every inch of computer power from their hands. Some people even think that pointers in C language are a waste of memory. For dynamic types, automatic memory management, object-oriented ...... Don't think about it. It will paralyze your computer.

 

However, this way of thinking upset Guido. Guido knows how to write a function in C language, but the entire writing process takes a lot of time (even if he knows exactly how to implement it ). Another option is shell. The Bourne shell has long existed as an interpreter (Interpreter) for UNIX systems. Unix administrators often use shell to write simple scripts for system maintenance, such as regular backup and file system management. Shell can connect many functions in UNIX like glue. Many programs with hundreds of lines in C language can be completed with only a few lines in shell. However, the essence of shell is to call commands. It is not a real language. For example, shell does not have a numeric data type, and addition operations are complex. In short, shell cannot fully mobilize computer functions.

(For more information about shell, see Linux architecture and Linux Command lines and commands)

 

Guido hopes to have a language that can fully call computer functional interfaces like the C language, and programming as easily as shell. The ABC language allows Guido to see what they want. ABC is composed of CWI (Centrum wiskunde & InformaticaDeveloped by the Institute of mathematics and computer science. Guido works in CWI and participates in the development of ABC. The ABC language aims at teaching. Unlike most languages at the time, the objective of ABC is"Make users feel better". ABC wishes to make the languageEasy to read, easy to use, easy to remember, easy to learnTo stimulate people's interest in programming. For example, the following is an ABC program from Wikipedia. This program is used to count the total number of words 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 define a function. A Python programmer should easily understand this program. The ABC language uses colons (:) and indentation to represent the program block (the C language uses {} to represent the program block ). There is no semicolon at the end of the line. There are no parentheses () in the for and if structures (). If you change how to def, change put row to collection = [], and Change Insert row to collection. append (Word), which is almost a standard Python function. The above function reads like a natural text.

 

Despite the good readability and ease of use, the ABC language is not popular in the end. At that time, the ABC language compiler needed a relatively high-configuration computer to run. These computer users are generally proficient in computers. They are more concerned with program efficiency than their learning difficulty. In addition to hardware difficulties, the design of the ABC language also has some fatal problems:

    • Poor scalability. ABC is not a modular language. If you want to add features in the ABC language, such as graphical support, you have to change a lot.
    • I/O cannot be performed directly.. ABC language cannot be operated directlyCompositionComponent System. Although you can import data through text streams, ABC cannot directly read and write files. The difficulty of input and output is critical to computer languages. Can you imagine a sports car that cannot open the door?
    • Over-Innovation. ABC expresses the meaning of a program in a natural language, such as how to in the above program ). For programmers, however, they are more accustomed to defining a function using function or define. Similarly, programmers are used to allocating variables with equal signs (=. Although this makes the ABC language appear special, it actually increases the learning difficulty of programmers (most programmers have more than one language ).
    • Difficult to disseminate. The ABC compiler is large and must be stored on tape (TAPE. At that time, when Guido was accessing, there was a large tape to install the ABC compiler for others. In this way, the ABC language is difficult to spread quickly.

IBM tape drive: read/write tape

 

In October 1989, Guido began to write Python compilers/interpreters to pass the Christmas holiday. Python comes from Guido's beloved TV series Monty Python's flying Cirque (the indoor Scene TV series played by bbc1960-february 1970, taking British life as the material ). He hopes that the new Python language can implement his philosophy (a fully functional, easy to learn, and extensible language between C and shell ). As a language design enthusiast, Guido has tried to design languages (not very successful. This is just a pure hacking behavior.

 

The birth of Python

In 1991, the first Python Compiler (also an interpreter) was born. It is implemented in C language and can call the C library (. So file ). Since its birth, Python already has core data types including: Class, function, exception, and list and dictionary, and a module-based expansion system.

Original Python logo: Designed by Guido's brother just von rosum

Many Python syntaxes come from C, but are strongly influenced by the ABC language. Some regulations from the ABC language are still controversial today, such as forced indentation. But these syntax rules make PythonCapacityEasy to read. On the other hand, Python's smart choice follows some conventions (especially the C language conventions ). For example, assign values with equal signs and define functions using def. Guido believes that there is no need to be overly entangled in things established in "common sense.

Python was particularly concerned from the very beginning.Scalability(Extensibility ). Python can be expanded at multiple levels. You can introduce the. py file at the higher level. At the underlying layer, You can reference the C language library. Python programmers can quickly use python to write. py files as expansion modules. However, when performance is an important factor in consideration, Python programmers can go deep into the underlying layer, write C Programs, compile the. So file into python for use. Python is like building a house with steel structures. It requires a large framework first. In this framework, programmers can freely expand or change.

Initially, python was developed entirely by Guido. Python is welcomed by colleagues from Guido. They quickly gave feedback on usage and participated in Python improvements. Guido and some colleagues form the core Python team. They spent most of their spare time on hack Python (also including working hours because they used python for work ). Later, python was extended to CWI. Python hides many machine-level details and gives them to the compiler for processing, highlighting the logic-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 says: Life is short, I use Python ). This feature attracts a large number of programmers. Python has become popular.

 

We had to pause our Python time and look at the computer overview. In the early 1990 s, personal computers started to enter ordinary homes. Intel released the 486 processor, and Windows released a series of Windows systems starting with Windows 3.0. The computer performance is greatly improved. Programmers began to focus on the ease of use of computers (bi-shaped interfaces ).

Windows 3.0

With the improvement of computer performance, the world of software has begun to change. Hardware is sufficient to meet the needs of many pcs. Hardware manufacturers even desire the emergence of high-demand software to drive the upgrade of hardware. C ++ and Java have become popular. C ++ and Java provide the object-oriented programming paradigm and rich object libraries. C ++ and Java greatly increase program output at the cost of certain performance. The ease of use of the language has been raised to a new height. We still remember that one important reason for ABC failure is the performance limitation of hardware. In this regard, python is much luckier than ABC.

Another quiet change is the Internet. In the 1990 s, it was still the era of personal computers. Windows and intel held a peak in the world with PC. Although the Internet-based information revolution has not yet arrived, many programmers and senior computer users are already using the Internet frequently (including email and newsgroup ). Internet greatly reduces the cost of information exchange. A new software development model is becoming popular: Open Source ). Programmers use their spare time to develop and open softwareSource code. Linus released the Linux kernel source in the comp. OS. minix news group in 1991.CodeTo attract a large number of hackers. Linux and GNU work together to form a dynamic open-source platform.

 

Hardware performance is not a bottleneck, and python is easy to use, so many people begin to switch to Python. Guido maintains a maillist, which allows Python users to communicate via emails. PythonUsers come from many fields with different backgrounds and different requirements for python.Python is quite open and easy to expand. Therefore, when users are not satisfied with the existing functions, it is easy to expand or transform python. Then, these users send the changes to Guido and decide whether to add the new features to Python or the standard library. This will be a great honor if the code can be incorporated into the python itself or the standard library. Python itself has become better.

(Guido has to make many decisions, which is also why he is called benevolent dictator for life)

Python is called "battery sorted ded", which means it and its standard library are powerful. These are the wholeCommunity. Python developers come from different fields and bring their advantages to Python. For example, the regular expression in the python standard library references Perl, while the lambda, MAP, filter, and reduce functions refer to lisp.Some functions of Python itselfAnd most of the standard libraries come from the community. The Python community continues to expand and has its own newsgroup, website (python.org), and fund (Python Software Foundation ). Since Python 2.0, Python has also changed from the maillist development method to a fully open-source development method. The Community atmosphere has been formed, and the work has been shared by the whole community. Python has also achieved a higher speed of development.

(Because Guido enjoys absolute Arbitration rights, many fans are quite worried about the life of Guido in the maillist Development era in the early days of Python. They even made assumptions: what will happen to Python if Guido fails. See if Guido was hit by a bus)

Today, the python framework has been established. The Python language organizes code (everything is object) with objects as the core. It supports multiple programming paradigms (Multi-paradigm) and uses dynamic typing ), automatic Memory collection ). Python supports interpreting (interpret) and can call the C library for expansion. Python has a powerful standard library (battery supported DED ). As the standard library system has been stable, the python ecosystem began to expand to third-party packages. These packages, such as Django, Web. py, wxpython, numpy, matplotlib, and Pil, upgraded python to a rich tropical rain forest.

 

Today, Python has entered the 3.0 era. Since Python 3.0 is backward incompatible, the transition from 2.0 to 3.0 is not easy. On the other hand, Python's performance is still worth improving. Python's computing performance is lower than C ++ and Java (see Google's discussion ). Python is still a developing language. I look forward to seeing the future of Python.

 

Python revelation

Python advocates elegance, clarity, and simplicity. It is an excellent and widely used language (ranking eighth in Tianyi language, Google's third-largest development language, Dropbox's basic language, and Douban's server language ). The world does not lack excellent languages, but the development history of Python, as a representative, has brought me many inspirations.

The community plays an important role in Python development. Guido thinks that he is not a full-fledged programmer, so he is only responsible for formulating the framework. If the problem is too complicated, he will choose to bypass it, that isCut the corner. These problems are eventually solved by others in the community. Talent in the Community is exceptionally rich, and some people are willing to deal with the process of creating a website and raising funds, which is a little farther away from development. Today, project development is becoming more and more complex, and cooperation and openness become the key to project success.

Python has learned a lot from other languages, including ABC, C, Perl, and many other languages not listed. It can be said that the success of Python represents the success of all the languages it draws on. Similarly, Ruby draws on python, and its success also represents the success of python in some aspects. Every language isHybridThey all have their advantages, but they also have all kinds of defects. At the same time, the judgment of a language "good and bad" is often subject to external reasons such as platforms, hardware, and the times. Programmers have experienced many language competitions. I think, why not distinguish between the advantages and disadvantages of each language with an open mind and objective analysis, and between internal and external factors. Maybe one day I find that a language I don't like contains what I need.

Regardless of the future fate of Python, the history of python is an interesting novel.

 

If you are interested in Python in this article, please read my quick Python tutorial.

 

This article mainly references:

Guido's speech at Dropbox

Http://v.youku.com/v_show/id_XNTExOTc1NTU2.html

Python.org documentation

Wikipedia

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.