Created
June 9, 2011 19:12
-
-
Save hvdklauw/1017471 to your computer and use it in GitHub Desktop.
MRO powerrrr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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