Skip to content

Instantly share code, notes, and snippets.

@pkulev
Created May 23, 2015 22:21
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 pkulev/68d34426c4d370d4a145 to your computer and use it in GitHub Desktop.
Save pkulev/68d34426c4d370d4a145 to your computer and use it in GitHub Desktop.
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