Steven D'Aprano wrote:
Given a class C, is there some way to find out what classes
issubclass(C, X) will return true for? Obviously you can get a partial
list, by walking the MRO, but is there a list somewhere of which ABCs
consider C a subclass?
Presumably the general answer is No, because any class X could happen to
have a __subclasscheck__ method that returns True when called with C.
New style class method __subclasses__ that returns a list of the immediate
subclasses. By recursing down from object, you can make a list of all new
style classes in your current interpreter. Then use issubclass to find
the ones that consider themselves subclasses of C.
-- HansM
--
http://mail.python.org/mailman/listinfo/python-list