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 -- http://mail.python.org/mailman/listinfo/python-list