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 ...

Get XML Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.