On 9/22/2013 2:57 PM, bab mis wrote:
def funlog(f):
def g(*args,**kw):
print "enter", f.__name__
try:
return f(*args, **kw)
finally:
print "exit", f.__name__
return g
class Action:
def __init__(self):
pass
@funlog
def sret(self):
pass
@funlog
def ping(self):
pass
def verifyerun(self):
pass
1) funlog is called for the last function as well.
If this is a question, no, it is not called on verifyerun.
2) Is it a proper way to define decorator out of class and use it .
Yes. It is not an Action methods. If you use it in multiple files,
define once in one file and import it.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list