On the first run, the python interpreter creates „intermediate machine code“. The second run is cached.
Python interpreter doesn't create machine code. The code it creates is called p-code (or "intermediate representation", or "bytecode"). Incidentally the "p" does not stand for Python, but for Pascal, because the concept was first used in UCSD Pascal implementation. At that time majority of interpreters were interpreting the source text directly (which is much slower than parsing into AST or P representation).
This design is based on JVM, and it's called JIT (just in time) compilation. Obviously due to it's dynamic typing systems a lot of object/variable handling is still done by the runtime rather than the direct code (but in many cases JIT optimizes code paths if it can infer it's exclusively dealing with, say, strings), which is why even V8 often executes code slower than, say, HotSpot, even if they both are very optimized JIT VMs.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.