interpreter vs. compiled

John Nagle nagle at animats.com
Fri Jul 25 14:24:13 EDT 2008


Tim Roberts wrote:
> And I'm saying you are wrong.  There is NOTHING inherent in Python that
> dictates that it be either compiled or interpreted.  That is simply an
> implementation decision.  The CPython implementation happens to interpret.
> The IronPython implementation compiles the intermediate language to native
> machine language.

     Well, actually there are some Python language features which make
static compilation to machine code difficult.  PyPy and Shed Skin
have to impose some restrictions on dynamism to make efficient
compilation feasible.  The big problem is "hidden dynamism", where the code
looks static, but at run time, some external piece of code replaces a
function or adds an unexpected attribute to what looked like a simple object
or function in the defining module.

     In CPython, everything is a general object internally, and all the
names are resolved over and over again at run time by dictionary lookup.
This is simple, but there's a sizable speed penalty.

					John Nagle



More information about the Python-list mailing list