Skip to content

Instantly share code, notes, and snippets.

@rrader
Created August 12, 2014 11:57
Show Gist options
  • Select an option

  • Save rrader/6baf0f4afd532c59fe11 to your computer and use it in GitHub Desktop.

Select an option

Save rrader/6baf0f4afd532c59fe11 to your computer and use it in GitHub Desktop.
Calling super in mixins
class A(object):
def m(self):
print 'A1'
try:
super(A, self).m()
except AttributeError:
print 'A has no super.m()!'
print 'A2'
class B(object):
def m(self):
print 'B1'
try:
super(B, self).m()
except AttributeError:
print 'B has no super.m()!'
print 'B2'
class C(A, B):
def m(self):
print 'C1'
super(C, self).m()
print 'C2'
c = C()
c.m()
print C.__mro__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment