How Python works from inside in Short

Internal Working of Python

Python does not covert its code to Machine code instead coverts into Byte code format (.pyc or .pyo)

CPU cannot understand this byte code and hence we need a interpreter to do this job that interpreter is called as Python Virtual Machine as a Virtual Machine is term here it is platform independent (Byte Code), and so we need python vm to execute Byte Code

Due to this many rookies like me get confused whether python is a interpreter or a compiler

Interpretation is part of python code execution

Steps of Inner code execution in python

  1. Given code is compiled by python to .py file this is your source code

  2. Python do not compiles this code into machine language directly, It compiles this code into byte code during this process it checks errors in code.

  3. After 2nd Step this code to goes finally to PVM (Python Virtual Machine) and gets converted to machine language in the form of 0's and 1's

Source > ./ Geeks for Geeks

#Hitesh_Choudhary #Python