python inheritance remove an attribute

Solutions on MaxInterview for python inheritance remove an attribute by the best coders in the world

showing results for - "python inheritance remove an attribute"
Rafael
06 Aug 2020
1Think carefully about why you want to do this; you probably don't. Consider not making B inherit from A.
2
3The idea of subclassing is to specialise an object. In particular, children of a class should be valid instances of the parent class:
4
5>>> class foo(dict): pass
6>>> isinstance(foo(), dict)
7... True
8If you implement this behaviour (with e.g. x = property(lambda: AttributeError)), you are breaking the subclassing concept, and this is Bad.