mengzhuo
2014-03-01 14:55:44 +08:00
自己试试看不就知道了————_没有_
至于unwrap,去掉decorator不就好了吗……
:def log(func):
...:@functools.wraps(func)
...:def wrapper(*args, **kwargs):
.......:return func(*args, **kwargs)
...:return wrapper
:@log
:def print_b(name):
...:"""hehe"""
...:print name
In [10]: dir(print_b)
Out[10]:
['__call__',
'__class__',
'__closure__',
'__code__',
'__defaults__',
'__delattr__',
'__dict__',
'__doc__',
'__format__',
'__get__',
'__getattribute__',
'__globals__',
'__hash__',
'__init__',
'__module__',
'__name__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'func_closure',
'func_code',
'func_defaults',
'func_dict',
'func_doc',
'func_globals',
'func_name']