changeset 264:efeb2cc78f30

stub this motha
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 17 Feb 2013 12:46:25 -0800
parents 7b15ed0b372c
children 4c11105b05d2
files python/bind.py
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()