for class can tell (non-virtual) superclasses via attribute __mro__
, (non-virtual) subclasses calling __subclasses__
.
for abc can tell virtual subclasses via attribute _abc_registry
.
is there way tell virtual superclasses of class, i.e. classes registered virtual subclass?
for abc can tell virtual subclasses via attribute '_abc_registry'.
no can't. can find explicitly registered virtual subclasses way. handled __subclasshook__
won't show in check.
to you're trying do, you'd have go through every abc ever defined in python session , call isinstance
. while technically possible in cpython traversing type hierarchy __subclasses__
method, it's bad idea.