Created
February 18, 2012 04:25
-
-
Save Kindari/1857394 to your computer and use it in GitHub Desktop.
Python Abomination
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 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