How do you specify in a Python parent class that certain fields/methods need to be overridden in the child classes?
You could raise a NotImplementedError:
def my_method(self, arg):
raise NotImplementedError('Implement me')
For properties, you can use the @property decorator:
@property
def my_property(self):
raise NotImplementedError('Implement me as well')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With