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