Say, I have a class Foo, extending class Bar. And I want to slightly override Foo's consructor. And I don't want even know what signarure of Bar's constructors is. Is there a way to do this?
If you didn't understand, I mean the following:
class Bar:
def __init__ (self, arg1=None, arg2=None, ... argN=None):
....
class Foo (Bar):
#Here i just want add additional parameter to constructor, but don't want to know anything about Bar's other parameters (arg1, arg2..., argN)
def __init__ (self, my_new_arg=None, ??? )
self.new_arg = my_new_arg
Bar.__init__(self, ??? )
Is there a way to put something short and elegant instead of ??? in this code? (Maybe some variations of args/kwargs)
Fooshould know so little aboutBar, why is it deriving fromBar? I mean, the given technique is a useful time-saver, but...__init__is not the constructor, it's an initializer, even though it's usually used in the same way. Otherwise__init__would be a@classmethod.