【发布时间】:2012-06-09 00:19:37
【问题描述】:
Python 装饰器的内部是否有任何“公认的”命名约定?
style guide 没有提及它,this awesome entry about decorators 在为返回的最终函数使用“包装”的变体方面非常一致,但是在创建带参数的装饰器时使用的名称呢?
def decorator_name(whatevs):
def inner(function):
def wrapped(*args, **kwargs):
# sweet decorator goodness
return wrapped
return inner
具体来说,上例中inner、function、wrapped的约定是什么?
【问题讨论】:
标签: coding-style python