Introduction to Python_learn,python Background

Source: Internet
Author: User

I. How the COMPUTER program works

Programs written in machine language can be run directly on a computer, and programs written in Assembly and advanced languages (often referred to as source programs) need to be "translated" into machine language to run. The way of "translating" the source program can be divided into two kinds: explanation mode and compiling method.

1. Explanation method

The explanation means that when the source program enters the computer, the translation program is translated into the program instructions, and every translation of an instruction is executed immediately.

2. Compiling method

Compiling method refers to the source program to enter the computer, the translator first translates the entire program into a machine language to express the target program, and then the computer to execute the target program, to obtain the results of the calculation, the interpretation will not produce the target program.

Figure 1-1 Comparison of compiled and interpreted types

How the Python program works

From a computer perspective, the Python program runs in two steps: Interpreter interpretation and Virtual machine run, 1-2.

Figure 1-2

You can write Python commands into a source code file and run the program by executing the source code file. The Python program source code file extension is typically. py. At execution time, the source code in the. py file is translated into byte code (bytecode, Java-like bytecode and. NET intermediate code) by the Python interpreter, and then by PVM (Python Virtual machine, Python virtual machine) translates bytecode into machine instruction execution. This mechanism of Python programs and Java,. NET is similar.

  

Introduction to Python_learn,python Background

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: 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.