【发布时间】:2014-05-21 15:15:36
【问题描述】:
在给定被包装的函数的情况下,有没有办法将参数传递给装饰器?例如,
@job('default')
def update_index():
call_command("update_index", remove=True)
func = update_index
args = ?? # How to use 'func' to get the string 'default' here?
【问题讨论】:
-
这似乎不适用于这里。他正在寻找包装函数的参数,而不是装饰器的参数。
标签: python decorator python-decorators