[Python-Dev] special method lookup: how much do we care?

Benjamin Peterson benjamin at python.org
Fri May 8 20:09:56 CEST 2009


A while ago, Guido declared that all special method lookups on
new-style classes bypass __getattr__ and __getattribute__. This almost
completely consistent now, and I've been working on patching up a few
incorrect cases. I've know hit __enter__ and __exit__. The compiler
generates LOAD_ATTR instructions for these, so it uses the normal
lookup. The only way I can see to fix this is add a new opcode which
uses _PyObject_LookupSpecial, but I don't think we really care this
much. Opinions?

-- 
Regards,
Benjamin


More information about the Python-Dev mailing list