carshing the interpreter in two lines

Alex Martelli aleax at mac.com
Sat Jun 3 14:12:19 EDT 2006


sam <samschul at pacbell.net> wrote:

> tomer:
> 
> It is my opinion that you would loose performance if the Python
> interpreter had the additional task of verifying byte code. It might be
> more appropriate to have a preprocessor that did the verifying as it
> compiled the byte code.

But in this case, there is no "compiled" -- just the code type's
constructor:

> > from types import CodeType as code
> > exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")

Yes, code() itself could do some sanity checking.  But so could 'exec'
-- it's never a particularly fast operation anyway... and most
definitely NOT on the critical path of normal operations.   I'd rather
have "defense in depth", in this case.


Alex



More information about the Python-list mailing list