[Zope] Ran out of Zen: Multiple inheritance and __init__ problems

Lennart Regebro lennart@regebro.nu
Mon, 14 Jan 2002 19:18:40 +0100


Sometimes when I inherit from multiple classes, I can do thusly:

class C( A, B):

    def __init__(self, foo):
        A.__init__(self, foo)
        B.__init__(self)

But sometimes this doesn't work, but python complains and sais that unbound
methods must be called with class instance 1st argument, although that is
exactly what I do.

Sometimes I can do this to solve that problem:
    def __init__(self, foo):
        A.__init__(self, foo)
        C.inheritedAttribute(__init__)(self)

And sometimes not even that works. And yes, I do restart the server without
anything changing.
Could somebody please try to make some kind of explanation of what is going
on and why? I don't understand this problem at all. Is there some known
caveats with these methods?