Nick Coghlan added the comment:

types is the OO equivalent to functools these days, in addition to its original 
role of exposing the internal type objects that aren't builtins.

However, it seems to me that the fix for issue 1785 is simply *wrong*: it 
eliminated the exceptions at the expense of sometimes returning the *wrong 
answer*. The change in that issue means the inspect module isn't implementing 
the descriptor protocol correctly, and thus may provide a raw descriptor object 
when attempting to retrieve that attribute will return something else.

Instead of the current behaviour, the inspect module should be trying getattr 
*first*, and only falling back to peeking in the __dict__ directly if that 
throws an exception.

----------
title: Make inspect.getmembers and inspect.classify_class_attrs Enum aware -> 
inspect.getmembers and inspect.classify_class_attrs mishandle descriptors

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19030>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to