[issue9732] Addition of getattr_static for inspect module
Guido van Rossum
report at bugs.python.org
Wed Sep 1 17:17:54 CEST 2010
Guido van Rossum <guido at python.org> added the comment:
> Since the addition of __dir__, dir(obj) can return arbitrary values. Typically (I guess) this will be used to add dynamically created attributes that this function will fail to find - so it is *more* likely that we will fail to find something in dir than the reverse.
>
> __dir__ could also be used to filter non-public members that getattr(...) would find. I would find it odd that getattr finds a member that exists but this function fails. I think this function is more akin to getattr than dir.
Gotcha.
> Perhaps a better warning would be that this function may fail to find members that getattr finds?
Ah, yes, and vice versa (well, just yesterday I wrote a descriptor
that always raises AttributeError :-).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9732>
_______________________________________
More information about the Python-bugs-list
mailing list