I. Explanatory language and compiled language
Explanatory language: Before the program executes, the program executes a compilation process through the compiler, transforming the program into machine language. The runtime does not need to be translated and executes directly. The most typical example is the C language.
Compiled language: Without the process of compiling, but when the program is running, through the interpreter to the program to explain the line, and then run directly, the most typical example is Ruby.
Summary: Because the compiler language in the program before the program has already made a "translation", so at run time there is less "translation" process, so the efficiency is higher. However, we cannot generalize that some explanatory language can be optimized for the whole program by the interpreter's optimization, which is more efficient than the compiled language.
In addition, with the rise of virtual machine-based languages such as Java, we cannot divide the language into two purely interpretative and compiled types. In Java, for example, Java is first compiled into a bytecode file by a compiler and then interpreted as a machine file by the interpreter at run time. So we say that Java is a language that is compiled and interpreted first.
Second, Python's running process
Pycodeobject and PYc files
Pycodeobject is the result that the Python compiler actually compiles.
When the Python program runs, the result of the compilation is saved in the Pycodeobject in memory, and when the Python program finishes running, the Python interpreter writes Pycodeobject back to the PYc file.
When the Python program runs for the second time, the program will first look for the PYc file on the hard disk, and if it is found, load it directly or repeat the process.
So we should be able to locate Pycodeobject and pyc files, we say that PYc file is actually a kind of persistent saving way of pycodeobject.
PYC: Pre-compiled byte-code file, not machine code
The path of Python-pyc