I have a derived class whose __init__ method only calls super().__init(...). However, the list of arguments to the super class is very long, which makes for a long list of mostly boiler plate:
def __init__(self, dataset, updater=None,
start_date=None,
end_date=None,
fill_missing_only=False,
total_sync: bool = False,
force: bool = False,
allow_missing: bool = False,
backfill=''):
super().__init__(self, dataset, updater,start_date, end_date,fill_missing_only,total_sync,force,allow_missing,backfill)
Is there a way to remove this and have the subclass call the base's init() method automatically?
I see two possibilities:
Just omit the __init__ method in the subclass - if you don't in fact override anything.
Use
def __init__(*args, **kwargs):
super().__init__(*args, **kwargs)
if you do some other things besides the super().__init__ call but don't need all arguments.
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