[Python-Dev] 'hasattr' is broken by design

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Aug 24 01:16:17 CEST 2010


Michael Foord wrote:

> It would be backwards incompatible with usage of hasattr for dynamically 
> created 'members' using __getattr__ though.

Also keep in mind that builtin types mostly don't keep
their attributes in dictionaries. To make this work
properly, hasattr would need its own special method.

-- 
Greg


More information about the Python-Dev mailing list