Compilation approach in Python

Modern languages like Python, Java, and C# use a different approach for program conversion and execution. Let’s understand this approach with reference to Python.

A PVM (also known as interpreter) is created for each new architecture. This interpreter is installed when we download and install Python.

A PVM is a software piece that emulates a physical computer. PVM is a stack machine, i.e., it manipulates several stacks to perform its operations (as contrasted with a real register machine, which writes to and reads from particular memory locations).

Programs written in Python are converted into bytecode instructions by the Python compiler. Bytecode instructions remain the same, irrespective of the microprocessor and OS combination.

During execution, bytecode instructions are interpreted by the virtual machine (VM) and then executed.

Get hands-on with 1400+ tech skills courses.