super and __init__ arguments (Was: Re: Multiple inheritance with a common base class)

Markus Bertheau twanger at bluetwanger.de
Tue Aug 10 09:38:35 EDT 2004


В Втр, 10.08.2004, в 15:01, Markus Bertheau пишет:

> That is what I needed to know. Thanks. It should probably be noted in
> the paragraph about multiple inheritance.

Now how do I make the following work:

class CommonBase(object):
    def __init__(self, c):
        pass
  
class LeafA(CommonBase):
    def __init__(self, c, a):
        super(LeafA, self).__init__(c)
  
class LeafB(CommonBase):
    def __init__(self, c, b):
        super(LeafB, self).__init__(c)
  
class Multi(LeafA, LeafB):
    def __init__(self, c, a, b):
        super(Multi, self).__init__(c, a, b)
  
m = Multi(0, 1, 2)

Thanks

-- 
Markus Bertheau <twanger at bluetwanger.de>




More information about the Python-list mailing list