Skip to content

Instantly share code, notes, and snippets.

@Kindari
Created February 18, 2012 04:25
Show Gist options
  • Save Kindari/1857394 to your computer and use it in GitHub Desktop.
Save Kindari/1857394 to your computer and use it in GitHub Desktop.
Python Abomination
class Service(object):
def __init__(self):
for method_name in dir(self):
method = getattr(self, method_name)
if callable(method) and hasattr(method, '__func__'):
for base in self.__class__.__bases__:
setattr(base, method_name, method.__func__)
class Foo(Service): pass
class Bar(Foo):
def test(self): print "Test"
b = Bar()
f = Foo()
f.test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment