-
-
Save tswicegood/971375 to your computer and use it in GitHub Desktop.
python diamond inheritance works
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 A(object): | |
def say(self): | |
print "This is A" | |
class B(object): | |
def say(self): | |
print "This is B" | |
class C(A, B): | |
def say(self): | |
print "This is C" | |
super(C, self).say() | |
C().say() |
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
$ python ~/foo.py | |
This is A | |
This is C | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment