This link has been bookmarked by 14 people . It was first bookmarked on 30 Oct 2008, by Chaim Krause.
-
-
inject or modify code in functions or classes
-
applied to a function definition
- 8 more annotations...
-
-
marcell marsclass entryExit(object): def __init__(self, f): self.f = f def __call__(self): print "Entering", self.f.__name__ self.f() print "Exited", self.f.__name__ @entryExit def func1(): print "inside func1()"
-
class entryExit(object):
def __init__(self, f):
self.f = f
def __call__(self):
print "Entering", self.f.__name__
self.f()
print "Exited", self.f.__name__
@entryExit
def func1():
print "inside func1()"
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.