Skip to content

Instantly share code, notes, and snippets.

@cesarkawakami
Created January 25, 2013 03:14
Show Gist options
  • Save cesarkawakami/4631441 to your computer and use it in GitHub Desktop.
Save cesarkawakami/4631441 to your computer and use it in GitHub Desktop.
class Base(object):
def __init__(self, pen, home):
super(Base, self).__init__()
class HomeMixin(Base):
def __init__(self, pen, home):
super(HomeMixin, self).__init__(pen, home)
self.home = home
class PenMixin(Base):
def __init__(self, pen, home):
super(PenMixin, self).__init__(pen, home)
self.pen = pen
class PenAndHome(PenMixin, HomeMixin):
pass
inst = PenAndHome("pen", "home")
print inst.pen # prints pen
print inst.home # prints home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment