@hoge Someone like
def poko(func):
print "poko"
return "poko_string"
@poko
def hoge():
pass
so
def hoge():
pass
hoge = poko(hoge)
Same as. Actually, you can use functool's wraps function
from functools import wraps
def poko(func):
@wraps(func)
def wrapper(*args, **kwargs):
"""Actions you want to add""""
# do pokopoko
#add hoge hoge
return func(*args, **kwargs)
return wrapper
@poko
def hoge():
pass
like
Recommended Posts