[docs] [issue17947] Code, test, and doc review for PEP-0435 Enum

Ethan Furman report at bugs.python.org
Sun May 12 07:25:21 CEST 2013


Ethan Furman added the comment:

Eli,

The original _StealthProperty checked to see if it was being called on instance or class, and if it was the class it invoked __getattr__ to attempt a lookup for an enum member.  Your version does not check, but, ironically, the exception raised is AttributeError, and so Python is calling __getattr__ anyway and so finds the virtual enum member.

While this is cool, and it works, I think it's much less mysterious, magical, and downright confusing to keep the original behavior and call __getattr__ from _StealthProperty.  On the other hand, it might make somebody think, and that's always good, so I'm happy to leave it your way.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17947>
_______________________________________


More information about the docs mailing list