Python Tutorials

Source: Internet
Author: User

Tags: that is System translation company message IMG Gap one document

Python is a computer programming language. You may have heard of a number of popular programming languages, such as the very difficult C language, the very popular Java language, the basic language for beginners, the JavaScript language for Web programming, and so on.

What kind of language is Python?

First, we popularize the basics of programming languages. In any programming language to develop the program, is to let the computer work, such as downloading a MP3, writing a document, and so on, and the computer working CPU only know the machine instructions, so, although the different programming languages are very big differences, and finally have to "translate" the CPU can execute machine instructions. and different programming languages, the same work, the amount of code written, the gap is also very large.

For example, to complete the same task, C language to write 1000 lines of code, Java only need to write 100 lines, and Python may be as long as 20 lines.

So Python is a fairly advanced language.

You may ask, is the code less good? The cost of the code is slow, the C program runs for 1 seconds, the Java program may take 2 seconds, and the Python program may take 10 seconds.

Is that the lower the more difficult the program, the more advanced the simpler the program? On the surface, yes, however, in very high abstract calculations, advanced Python programming is also very difficult to learn, so the Advanced programming language is not equal to simple.

However, the Python language is very easy to use for beginners and to accomplish common tasks. Even if Google is using Python on a massive scale, you won't have to worry about learning.

What can I do with python? Can do daily tasks, such as automatic backup of your MP3, can do website, many famous websites including YouTube is written by Python, can do online game backstage, many online game backstage are developed by Python. It's a lot of things to be able to do anyway.

Python, of course, does not have the ability to do things, such as writing the operating system, which can only be written in C language, mobile phone applications, only with Swift/objective-c (for the iphone) and Java (for Android), write 3D games, preferably in C or C + +.

about Python

Python is a programming language written by the famous "Uncle Turtle" Guido van Rossum during Christmas 1989 to send a boring Christmas.

Today, there are almost 600 programming languages around the world, but popular programming languages are so 20来. If you've ever heard of the Tiobe leaderboard, you can see how popular the programming language is. This is the most commonly used 10 programming language change graph in the last 10 years:

In general, these programming languages are different. C language is a hardware-close language that can be used to write operating systems, so the C language is suitable for developing programs that seek to run faster and give full play to hardware performance. Python is a high-level programming language for writing applications.

When you start a real software development in a language, you'll need a lot of basic, already written stuff in addition to writing your code to help you speed up your development process. For example, to write an e-mail client, if the first to start writing network protocol-related code, it is estimated that a year can not be developed. High-level programming languages often provide a well-established codebase that you can invoke directly, for example, an SMTP library for an e-mail protocol, a GUI library for a desktop environment, developed on top of these existing code bases, and an e-mail client can be developed in a few days.

Python provides us with a very well-established codebase, covering a wide range of content, such as networks, files, GUIs, databases, text, and so on, and is visually called "Built-in battery (batteries included)". Developed in Python, many features do not have to be written from scratch, directly using ready-made.

In addition to the built-in libraries, Python also has a large number of third-party libraries, which others have developed for you to use directly. Of course, if you develop code that is well encapsulated, it can also be used as a third-party library for others.

Many large web sites are developed in Python, such as YouTube, Instagram, and the domestic watercress. Many large companies, including Google, Yahoo, and even NASA, have used python in large numbers.

Uncle Turtle to Python positioning is "elegant", "clear", "simple", so the Python program seems always easy to understand, beginners learn python, not only easy to get started, and in the future, can write those very very complex programs.

In general, Python's philosophy is simple and elegant, as much as possible to write easy-to-read code, as far as possible to write less code. If a veteran programmer shows off the obscure, tens of thousands of-line code he writes, you can laugh at him.

What types of applications are Python suited to develop?

Preferred is the Web application, including the website, background services and so on;

The second is a lot of daily needs of small tools, including the system administrator needs the script task, etc.;

In addition, the development of other language programs to be packaged again, easy to use.

Finally, talk about the shortcomings of Python.

Any programming language has drawbacks, and Python is no exception. The pros have said, what are the drawbacks of Python?

The first drawback is that it is slow to run, and very slow compared to the C program, because Python is an interpreted language, and your code is executed in a line-by-line translation into a machine code that the CPU can understand, which is very time-consuming and slow. The C program is a machine code that compiles directly to the CPU before it runs, so it's very fast.

But a lot of applications don't need to run so fast, because users don't feel it at all. For example, to develop a download MP3 Web application, c program run time takes 0.001 seconds, and the Python program run time needs 0.1 seconds, 100 times times slower, but because the network is slower, need to wait 1 seconds, you think, users can feel 1.001 seconds and 1.1 seconds difference? This is like the F1 car and the ordinary taxi on the third Ring road in Beijing, the same reason, although the F1 racing theory speed of up to 400 km, but because the third ring road traffic jam speed of only 20 kilometers, so as a passenger, you feel the speed is always 20 kilometers.

The second drawback is that the code cannot be encrypted. If you want to publish your Python program, actually publish the source code, which is different from the C language, C language does not have to publish the source code, only need to post the compiled machine code (that is, you are common on Windows Xxx.exe file) published. It is impossible to eject C code from the machine code, so there is no such problem in any compiled language, and the language of interpretation must be published.

This drawback is limited to the time you need to write software that needs to be sold to someone else for money. The good news is that the current Internet era, by selling software licensing business model less and more, relying on the website and mobile app selling services more and more models, the latter model does not need to give the source to others.

Moreover, now in full swing open source movement and the Internet free and open spirit is consistent, the Internet has countless very good linux-like open source code, we must not overestimate the code that you write really has very big "business value". The more important reason that the code of those big companies don't want to open is that the code is too bad, and once open source, no one dares to use their product.

Of course, Python has a few other minor shortcomings, please ignore them, do not list.

Python Tutorials

Related Article

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: and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: