Asymmetry in globals __getitem__/__setitem__

Paul Sokolovsky pmiscml at gmail.com
Fri Jun 13 07:28:36 EDT 2014


Hello,

On Fri, 13 Jun 2014 12:53:54 +0200
Peter Otten <__peter__ at web.de> wrote:

[]

> > exec(fun.__code__, {}, Namespace())
> > 
> > 
> > Neither __getitem__ nor __setitem__ seem to be called on the local
> > variables.
> 
> Accessing fun.__code__ is clever, but unfortunately the compiler
> produces different bytecodes for loading/storing variables inside a
> function. Compare:

Compiler produces different bytecodes, and allocates local variables on
stack (just like C) very fortunately, steps like that allowed Python to
drop moniker of "ridiculously slow language". And people should decide
what they really want - fast language which can stand against the
competition, or language with dynamicity and reflection capabilities
beyond any practical need. I make first choice any time. And then it
makes sense to just accept that any function can be JIT (or AOT)
compiled, and there's nothing to fish inside of it (but for the raw
machine code of unknown architecture).


-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com



More information about the Python-list mailing list