Skip to main content

Command Palette

Search for a command to run...

Understanding How Python Operates in Simple Terms

Updated
2 min read

Python is an interpreted language. Firstly a Python interpreter is used which is nothing but a Python software, and a script also called as a Python program is given to the interpreter.

After the instructions in the Python program is completed, Python generates a byte code which is mostly hidden but is visible in few cases such as when a file is imported.

When Python is installed, along with it the Python Virtual Machine (PVM) is installed.
The byte code that is generated by Python is fed into the PVM and the code is run here.

The program is compiled to Byte code which is a low level code and platform independent. Byte code runs faster than the script (Python program) and hence it is preferred by Python.
The .pyc file is nothing but compiled python. It plays a major role in platform independence.
This .pyc is sometimes deleted and reconstructed or multiple versions of it are created as the there will be many changes in the code.
Since there will be many of these files, Python organises and stores these files
in a folder called "__pycache__".

What is Python Virtual Machine (PVM) ?

  • It is a software in which a loop is running continuously and executes or runs a file that is fed into it.

  • Files such as byte code, Python scripts can be fed into it. PVM executes these files from start to end. This is why Python is called interpreted language because of the PVM.The PVM is also called as the Runtime Engine. It is also called as the Python Interpreter.

Also note that the byte code is not machine code. Byte code in reference to Python language is Python specific interpretation. Machine code is a direct instruction to the hardware.