An idiom for code generation with exec

Terry Reedy tjreedy at
Tue Jun 24 01:40:03 EDT 2008

eliben wrote:

> And while we're on the topic of what compilation means in Python,

It depends on the implementation.

> not sure I fully understand the difference between compiled (.pyc)
> code and exec-ed code. Is the exec-ed code turned to bytecode too,
> i.e. it will be as efficient as compile-d code ?

CPython always compiles to bytecode before executing.  There is no 
alternative execution path.

More information about the Python-list mailing list