Interpretation

Steven D'Aprano steve at pearwood.info
Sat Mar 26 23:45:28 EDT 2016


On Sun, 27 Mar 2016 02:22 pm, Mario R. Osorio wrote:

> OTOH, python code is not supposed to be compiled.

Technically, Python code is compiled, to byte-code rather than machine-code,
but still compiled.

That's what is inside the .pyc files you will often see after importing
modules. And Python even has a built-in function called "compile" that
takes source code and compiles it a code object:

py> x = compile("value = 23", "", "single")
py> type(x)
<class 'code'>
py> print(x)
<code object <module> at 0xb7993300, file "", line 1>
py> eval(x)
py> print(value)
23



-- 
Steven




More information about the Python-list mailing list