sayap sayap - 11 months ago 63
Python Question

python multiple inheritance from different paths with same method name

With the following code sample, can

be used, or
has to call

class A(object):
def foo(self):
print ''

class B(object):
def foo(self):
print ''

class C(A, B):
def foo(self):
print ''

Answer Source

super() will only ever resolve a single class type for a given method, so if you're inheriting from multiple classes and want to call the method in both of them, you'll need to do it explicitly.