Here is a simplified guide to understanding how Python code becomes a functioning program:
1) ??????? ??? ????: We start with typing out our Python program in a text editor, saving it as a ‘.py’ file.
2) ?????? ???????????: When we run the program, it’s sent into the Python Interpreter, which is made up of two parts:
- ????????: This part changes our Python code into something called byte code. This byte code is saved in a ‘.pyc’ file, helping our program run faster the next time.
- ?????? ??????? ??????? (???): The PVM uses the byte code and follows the instructions one by one until the program is finished or runs into an error.
3) ??????? ???????: If our program uses library modules from Python’s standard library or elsewhere, these are also changed into byte code. The PVM then uses this byte code, allowing our program to use the features of these modules.
4) ???? ???? ???? ?? ??????? ????: The PVM further converts the byte code into machine code, which is a series of 1s and 0s. This machine code is what your computer’s brain, the CPU, can directly understand.
5) ??????? ??? ???????: After the machine code is ready, your computer uses it to run your program. And there you have it! Your Python program is up and running.
Understanding the transition from Python code to a running program provides insight into how Python, as an interpreted language, bridges the gap between the high-level code we write and the low-level operations performed by a computer.