Skip to content

Instantly share code, notes, and snippets.

@ludwig
Created May 6, 2013 20:36
Show Gist options
  • Save ludwig/5527987 to your computer and use it in GitHub Desktop.
Save ludwig/5527987 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
class Base(object):
def foo(self):
print("Base")
return True
class Mixin(object):
def foo(self):
print("Mixin logs bar {0}".format(self.bar))
return super(Mixin, self).foo()
class A(Mixin, Base):
def foo(self):
print("A")
self.bar = 1
return super(A, self).foo()
a = A()
a.foo()
@ludwig
Copy link
Author

ludwig commented May 6, 2013

Output is

A
Mixin logs bar 1
Base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment