Do you know how Python code runs?

The Python Interpreter works in two steps:

✅ Compiler – converts source code into byte code

✅ PVM – converts byte code into machine code

Keep Learning , Keep Growing

#Python #CodingBasics #TuxAcademy #KeepLearning #KeepGrowing

@TuxAcademyAdmin no, it doesn’t.
@holdenweb
Please explain what do you want to say.
@TuxAcademyAdmin it’s an interpreter, not a two-pass compiler. They bytecode is not converted into machine code, but used to direct calls to a virtual machine.
@TuxAcademyAdmin so the VM does not “convert bytecode into machine code” as a compiler does.
Dear @holdenweb you are right that python is an interpreter. But it works differently that other language's interpreter. At first, python interpreter acts like a compiler to convert our source code into bytecode, then this bytecode is passed to PVM for execution to machine code.
@TuxAcademyAdmin I would recommend you stop digging. The hole is deep enough already.
@TuxAcademyAdmin in CPython each bytecode causes a switch to an appropriate piece of compiled C code inside the eval.c file. No translation to machine code takes place.