菜鸟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
博客聚焦Python函数装饰器,提到有文章称理解Python装饰器看一篇就够,还有12步教你理解的内容,同时指出函数是和其它东西一样的对象且有属性。
953

被折叠的 条评论
为什么被折叠?



