装饰器
一、装饰器 In [1]: def fn(): ...: '''this is fn''' ...: In [2]: help(fn) Help on function fn in module __main__: fn() this is fn In [4]: fn.__doc__ # 存储函数的文档 Out[4]: 'this is fn' In [5]: fn.__name__ # 存储函数的名字 Out[5]: 'fn' In [6]: dir(fn) # 查看fn 所有的 内嵌方法 Out[6]: ['__annotations__', '__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__get__', '__getattribute__', '__globals__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__kwdefaults__', '__le__', '__lt__', '__module__', '__name__', '__ne__