6.5. Executing Python Programs
As you know, Python programs are executed directly from their textual form rather than compiled. Behind the scenes, Python does a certain amount of compilation on source files. They are compiled into into an intermediate representation known as Python bytecode. The bytecode is an intermediate representation of your program suitable for execution on the Python Virtual Machine. Python is similar to Java, Visual Basic, and Smalltalk in this regard. This bytecode is written to disk as a file with the same base name as the .py file but with a .pyc extension. Python uses timestamp logic to decide if it needs to regenerate the .pyc files from .py files. That is, it checks the modification time of the .py file against the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access