B
bab mis
def fun:
print "entry"
print "entry"
.... def g(*args, **kw):bab said:def fun:
print "entry"
.
.
print "exit"
def fun:
print "entry"
.
.
print "
def fun:
print "entry"
.
.
print "exit"
def fun:
print "entry"
.
.
print "exit"
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.
2) Is it a proper way to define decorator out of class and use it .
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.