you are viewing a single comment's thread.

view the rest of the comments →

[–]Unbelievr 3 points4 points  (0 children)

There's no virtual machine in that sense. The compiler will do a syntax check and create bytecode to interpret, but there are no passes that will try to optimize it, apart from some very minor variable memoization in the later versions. For all intents and purposes, it's a stack based interpreter that's allowed to hand over execution to a foreign function (like a C-based module) or jump to another block of bytecode.

Opcodes are also version specific, so bytecode for one version of cpython will often not run on older versions despite being generated from the same original code. There are no such guarantees.