Calling __init__ with multiple inheritance
Axel Straschil
axel at straschil.com
Tue Mar 29 07:21:30 EST 2005
Hello!
>> Also, lool at that:
>> class Mother(object):
>> def __init__(self, param_mother='optional', **eat):
>> print 'Mother'
>> class Father(object):
>> def __init__(self, param_father='optional', **eat):
>> print 'Father'
>> class Child(Mother, Father):
>> def __init__(self, **ham):
>> super(Child, self).__init__(**ham)
>> child = Child(param_mother=1, param_father=1)
>> Father's init will not be called.
> Change Father/Mother.__init__() to call the superclass initializer. It may
> be counterintuitive, but it works.
OK, thanks, with the super(...).__init__() in Father/Mother it workes
and makes sense.
So, the last thing a *realy* don't like ist the
__init__(self, param, **ignore_the_rest) thing.
Anyone had troubles with that, or should I cust take this as a "python
way of thinking" ... ;-), and getting used to that?
Thanks,
AXEL.
--
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
More information about the Python-list
mailing list