Skip to content

Instantly share code, notes, and snippets.

@hvdklauw
Created June 9, 2011 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hvdklauw/1017471 to your computer and use it in GitHub Desktop.
Save hvdklauw/1017471 to your computer and use it in GitHub Desktop.
MRO powerrrr
class RelatedField(object):
def __init__(self, *args, **kwargs):
sup = super(RelatedField, self)
if hasattr(sup, 'test'):
sup.test()
class Field(object):
def test(self):
print "Test on Field"
class C(RelatedField):
pass
class D(RelatedField, Field):
pass
c = C()
d = D()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment