In [1]:
class A(object):
    def __init__(self, v, *args, **kwargs):
        print "A:init:v[{0}]".format(v)
        kwargs['v']=v
        super(A, self).__init__(*args, **kwargs)
        self.v = v
In [2]:
class MixInF(object):
    def __init__(self, *args, **kwargs):
        print "IObject:init"
    def f(self, y):
        print "IObject:y[{0}]".format(y)
In [3]:
class B(MixInF):
    def __init__(self, v, *args, **kwargs):
        print "B:init:v[{0}]".format(v)
        kwargs['v']=v
        super(B, self).__init__(*args, **kwargs)
        self.v = v
    def f(self, y):
        print "B:f:v[{0}]:y[{1}]".format(self.v, y)
        super(B, self).f(y)
In [4]:
class C(MixInF):
    def __init__(self, w, *args, **kwargs):
        print "C:init:w[{0}]".format(w)
        kwargs['w']=w
        super(C, self).__init__(*args, **kwargs)
        self.w = w
    def f(self, y):
        print "C:f:w[{0}]:y[{1}]".format(self.w, y)
        super(C, self).f(y)
In [5]:
class Q(C,B,A):
    def __init__(self, v, w):
        super(Q, self).__init__(v=v, w=w)
    def f(self, y):
        print "Q:f:y[{0}]".format(y)
        super(Q, self).f(y)
In [6]:
q = Q(5,6)
q.f(7)
C:init:w[6]
B:init:v[5]
IObject:init
Q:f:y[7]
C:f:w[6]:y[7]
B:f:v[5]:y[7]
IObject:y[7]
In [7]:
class Q1(A,B,C):
    def __init__(self, v, w):
        super(Q1, self).__init__(v=v, w=w)
    def f(self, y):
        print "Q1:f:y[{0}]".format(y)
        super(Q1, self).f(y)
In [8]:
q = Q1(5,6)
q.f(7)
A:init:v[5]
B:init:v[5]
C:init:w[6]
IObject:init
Q1:f:y[7]
B:f:v[5]:y[7]
C:f:w[6]:y[7]
IObject:y[7]
In [9]:
class Q2(C,A,B):
    def __init__(self, v, w):
        super(Q2,self).__init__(v=v, w=w)
    def f(self, y):
        print "Q2:f:y[{0}]".format(y)
        super(Q2,self).f(y)
In [10]:
q = Q2(5,6)
q.f(7)
C:init:w[6]
A:init:v[5]
B:init:v[5]
IObject:init
Q2:f:y[7]
C:f:w[6]:y[7]
B:f:v[5]:y[7]
IObject:y[7]
In [10]:
 
In [ ]: