Created
May 23, 2015 22:21
-
-
Save pkulev/68d34426c4d370d4a145 to your computer and use it in GitHub Desktop.
This file contains 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 foo(self): | |
print(1) | |
class B(object): | |
def foo(self): | |
print(2) | |
class C(A, B): | |
@staticmethod | |
def reverse_mro(cls): | |
cls.__bases__ = cls.__bases__[::-1] | |
def __init__(self): | |
self.reverse_mro(self.__class__) | |
self.foo() | |
>>> 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment