# HG changeset patch # User Jeff Hammel # Date 1361133985 28800 # Node ID efeb2cc78f304e3c93021bb233bac185b3ab93a0 # Parent 7b15ed0b372c3dbefbb0df21e1546f3aaece411a stub this motha diff -r 7b15ed0b372c -r efeb2cc78f30 python/bind.py --- a/python/bind.py Fri Feb 15 15:18:31 2013 -0800 +++ b/python/bind.py Sun Feb 17 12:46:25 2013 -0800 @@ -9,8 +9,20 @@ @classmethod def create(cls): """create an instance and bind a method onto foo""" - + class decorator(object): + def __init__(self, function): + self.function = function + def __call__(self): + print "Bar!" + return self.function() + + instance = cls() + instance.foo = decorator(instance.foo) + return instance def foo(self): print "Foo!" +if __name__ == '__main__': + foo = Foo.create() + foo.foo()