I'd like to create an Python class that superficially appears to be a subclass of another class, but doesn't actually inherit its attributes.
For instance, if my class is named B
, I'd like isinstance(B(), A)
to return True
, as well as issubclass(B, A)
, but I don't want B
to have the attributes defined for A. Is this possible?
Note: I don't control the implementation of A
.
Why I care: The module I'm working with checks that a passed object is a subclass of A
. I want to define the necessary attributes in B
without inheriting the superfluous attributes defined in A
(whose implementation I do not control) because I'm using __getattr__
to pass some attribute calls onto a wrapped class, and if these attributes are defined by inheritance from A, __getattr__
won't be called.