Learn and guide Python Dynamic Language

Source: Internet
Author: User

Some people say that the Python Dynamic Language is an explanatory language, but this statement is incorrect. In fact, the Python language is an object-oriented, literal translation computer programming language, it is also a powerful and perfect general-purpose language. For the first time users who are familiar with programming, Python is definitely the first choice.

However, many people will discard it after using basic for a period of time, because they feel that there are too few functions besides play. Even vb has incomplete functions. In many cases, components written in other languages and APIs can be called directly to complete functions. Python, however, looks like a toy. In addition, the interactive command line gives people the feeling of teaching language, which strengthens people's ideas.

However, Python functions cannot be said to be weak, but they are actually very powerful. Python has built-in important data structures and files, and contains a large standard library, which basically covers the functional requirements from the GUI to the database to the network.

There are also many fans. Companies write third-party libraries for python. These libraries have a wide variety of functions. You can also package libraries in other languages for your own use. It is also possible to write extended libraries directly using languages like c.

Therefore, python is as studious as basic, but its functions are much more powerful. Python is slow and can only be used in a few applications. For people who are used to assembly and C ++, there is always an inertia in their thinking (including I have also gone through such a stage ).

It means that the file size is a digital section, and the overhead of any Runtime is absolutely not allowed. When we see a dynamic language such as python and a very dynamic language, It is also reasonable to see how difficult it is. The key question first is whether you need to save that amount by 100 ~ The size of kb.

The current memory, hard disk, and network communication environments do not care much about this space, so the size is not a problem. Is the running time critical? In fact, in many cases, it does not require that fast speed. For example, if you open a window and run it with a latency of 100 ms, do you feel it?

Python can also convert the py file into a pyc file to accelerate the interpretation of the source file. Pre-reading such as just in time or hot spot in a java virtual machine can be equivalent to pre-compiled Technology for python.

Another major benefit of the Python Dynamic Language is the ability to write extension modules in a fast language such as C. In software, 20% of the Code occupies 80% of the running time. In this way, you can first use tools such as benchmark to see if the software is too slow to endure, and then use profiler to find out where the problem is and where the bottleneck is, then you can use C to solve the key code.

This saves development time (most of the Code is written in python and faster than C), and the running speed is satisfactory. Therefore, there is no need to worry about the speed of python. But for the sake of objectivity, python is slow. In python, everything is an object. This is worse than a less pure OO language like java.

This is mainly because python is dynamic, so the lack of static type checks makes it difficult to find errors in the program. The settings may indicate that the syntax of the unexecuted block is not thoroughly checked. The variable is not declared, so it is prone to write errors by mistake. Is it really so bad?

The first lack of type check means that a function has several parameters, but because the parameter type is dynamically determined, therefore, there is no way to check whether the input parameters and parameter tables match in static mode. The problem is that the function you write must be tested by yourself.

Once a problem occurs, you can easily find the cause of the error. Dynamic typing is so flexible and easy to use, so it is worth the trouble. The second is wrong. All the syntaxes in python are checked. Even in the branch statement. It is only possible that you are talking about this situation.

For people who are used to assembly and C ++, there is always an inertia in their thinking (including I have also gone through such a stage ). It means that the file size is a digital section, and the overhead of any Runtime is absolutely not allowed. When we see a dynamic language such as python and a very dynamic language, It is also reasonable to see how difficult it is.

The key question first is whether you need to save that amount by 100 ~ The size of KB, the current memory, hard disk, network communication environment is not very concerned about such a little space, so the size is not a problem. Is the running time critical? In fact, in many cases, it does not require that fast speed. For example, if you open a window and run it with a latency of 100 ms, do you feel it?

The Python dynamic language can also process The py file into a pyc file to accelerate the interpretation of the source file. Pre-reading such as just in time or hot spot in a java virtual machine can be equivalent to pre-compiled Technology for python.

Another major benefit of python is the ability to write extension modules in a fast language such as C. In software, 20% of the Code occupies 80% of the running time. In this way, you can first use tools such as benchmark to see if the software is too slow to endure, and then use profiler to find out where the problem is and where the bottleneck is, then you can use C to solve the key code. This saves development time (most of the Code is written in python and faster than C), and the running speed is satisfactory.

  1. Introduction to Python system files
  2. How to correctly use Python Functions
  3. Detailed introduction and analysis of Python build tools
  4. Advantages of Python in PythonAndroid
  5. How to Use the Python module to parse the configuration file?

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.