After playing around with the super keyworld in Python, I finally stumbled across this question which helped explain some multiple inheritence, with arguments. This also helped me to understand the use of super in Python and how to whole thing links together. I edited the original answer to the question as I found Python complaining about the arguments being passed into the last __init__.

class Mother(object):
    def __init__(self, p_mother, **more):
        print "Mother", p_mother, more
        self.p_mother = p_mother
        super(Mother, self).__init__(p_mother=p_mother, **more)

    def hello(self):
        print "Hello %s" % self.p_mother

class Father(object):
    def __init__(self, p_father, **more):
        print "Father", p_father, more
        self.p_father = p_father
        super(Father, self).__init__()

    def world(self):
        print "World %s" % self.p_father

    def hello(self):
        print "Hello %s" % self.p_father

class Child(Mother, Father):
    def __init__(self, p_mother, p_father, **more):
        print "Child", p_father, p_mother, more
        super(Child, self).__init__(p_mother=p_mother, p_father=p_father,
                                    **more)

if __name__ == '__main__':
    c = Child("Mother", "Father")
    c.hello()
    c.world()

Search

Bad implementation always trumps good ideas

19 September 2015 11:34 a.m.

Good practice in software development has always preached loose coupling and high cohesion.

While most developers understand this and try ...

Read More

New platform, new challenges

13 September 2015 19:13 p.m.

There was a question raised by a collegue of mine recently, that asked "How long should it take to get ...

Read More

SaltStack and Vagrant

14 February 2013 15:14 p.m.

Salt is an open source infrastructure management tool. While one use is to manage thousands of servers, it’s also very ...

Read More