使用
functools.wraps()更新装饰的属性:
from functools import wrapsdef decorator(f): @wraps(f) def _decorator(): print 'decorator active' f() return _decorator@decoratordef foo(): '''the magic foo function''' print 'this is function foo'help(foo)
另请参阅标准库文件的
functools。



