[Tutor] Calling super classs __init__?
tiger12506
keridee at jayco.net
Sat Mar 22 03:48:41 CET 2008
>> class SubClass(BaseClass):
>> def __init__(self, t, *args, **kw):
>> super(SubClass, self).__init__(*args, **kw)
>> # do something with t
> Is there a proper way to handle the case when SubClass() is called using
> positional arguments, and you do not desire "t" to be at the beginning?
Sorry. If you are using *args and **kw then t has to be at the beginning.
Hmm... Unless you consider t to be part of *args or **kw, then you could
process those before the call to super's __init__. After the def and before
the call to the super's __init__, *args and **kw are just a list and a
dictionary. You can edit them however you wish. ;-)
Also, does anyone want to clarify? I thought that super() only return one of
the base classes and was frowned upon for objects using multiple
inheritance???
More information about the Tutor
mailing list