菜鸟Python函数装饰器
理解 Python 装饰器看这一篇就够了-刘志军
12步教你理解Python装饰器-刘志军
函数是和其它任何东西一样的对象
函数也有属性
>>> def outer():
print("this is outer")
def inner():
print("inside inner")
return inner
>>> foo =outer()
this is outer
>>> outer()
this is outer
<function outer.<locals>.inner at 0x000001C5EFF43E18>
>>> foo
<function outer.<locals>.inner at 0x000001C5F0950400>
>>> foo()
inside inner