[Interface-dev] ClassProvides vs. inspect.getmembers

Thomas Lotze thomas at thomas-lotze.de
Wed Jul 8 16:32:40 EDT 2009


Jim Fulton wrote:

> Inspection is already broken.  It isn't at all invalid for a descriptor to
> raise AttributeError. The inspector should not assume that just because
> something is in the class dict, it is an attribute.

Too bad the standard library's inspector does just that.

> If we were going to work around this inspect bug, the way to do it would
> be to find a way to deal with this without a class __provides__ attribute,
> probably by storing the data outside a class. This would be a pain, but
> would be typical of the pain caused by Python's second- class treatment of
> classes.

Sounds like nothing I'd like to tackle if it can be avoided. Far easier to
try and make the client code do something better than assume
inspect.getmember() to work in this use case.

-- 
Thomas





More information about the Interface-dev mailing list