7stud <[EMAIL PROTECTED]> wrote: > When I run the following code and call super() in the Base class's > __init__ () method, only one Parent's __init__() method is called. > > > class Parent1(object): > def __init__(self): > print "Parent1 init called." > self.x = 10 > > class Parent2(object): > def __init__(self): > print "Parent2 init called." > self.y = 15 > > class Base(Parent1, Parent2): > def __init__(self): > super(Base, self).__init__() > self.z = 20 > > b = Base() > > --output:-- > Parent1 init called.
Yep -- Parent1.__init__ doesn't call its own super's __init__, so it doesn't participate in cooperative superclass delegation and "the buck stops there". Alex -- http://mail.python.org/mailman/listinfo/python-list