Replacing globals in exec by custom class

Jonathan S jonathan.slenders at gmail.com
Thu Dec 9 08:28:25 EST 2010


Thanks for your response! (And sorry about the syntax error, I forgot
to test my code after cleaning up some debug statements before
posting, the else should have been elif indeed.)

It's very interesing, how Python works internally. According to a
thread on the Python mailing list in 2002, it seems that the
implementation of CPython bypasses __getitem__ of the dict object,
when it is used as Global namespace. (For performance reasons.)

http://mail.python.org/pipermail/python-dev/2002-October/029753.html



More information about the Python-list mailing list