| Store | Cart

Calling __init__ with multiple inheritance

From: Axel Straschil <a...@straschil.com>
29 Mar 2005 12:21:30 GMT
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

Recent Messages in this Thread
Axel Straschil Mar 28, 2005 12:51 pm
Peter Otten Mar 28, 2005 02:08 pm
jfj Mar 29, 2005 03:27 am
Peter Otten Mar 28, 2005 05:51 pm
jfj Mar 29, 2005 04:53 am
Peter Otten Mar 28, 2005 07:53 pm
Axel Straschil Mar 29, 2005 05:53 am
Steven Bethard Mar 29, 2005 07:02 am
Peter Otten Mar 29, 2005 08:37 am
Axel Straschil Mar 29, 2005 12:21 pm
jfj Mar 29, 2005 07:38 pm
Robert Dick Mar 28, 2005 07:14 pm
phil...@yahoo.com Mar 28, 2005 04:07 pm
Messages in this thread