Skip to content

Instantly share code, notes, and snippets.

@sbinet
Created February 11, 2016 17:27
Show Gist options
  • Save sbinet/3cf75ba564e6d3a79d93 to your computer and use it in GitHub Desktop.
Save sbinet/3cf75ba564e6d3a79d93 to your computer and use it in GitHub Desktop.
class A(object):
def __init__(self, v):
self.v = v
print "A.v:",self.v
class B(A):
def __init__(self, v):
super(B, self).__init__(v)
self.v += 10
print "B.v:",self.v
class C(A):
def __init__(self, v):
super(C, self).__init__(v)
self.v += 100
print "C.v:",self.v
class D(B,C):
def __init__(self, v):
super(D,self).__init__(v)
self.v += 1000
print "D.v:",self.v
d = D(1)
print "d:",d.v
$> python2 ./multiple.py
A.v: 1
C.v: 101
B.v: 111
D.v: 1111
d: 1111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment