python中什么是闭包

当一个嵌套函数在其外部区域引用了一个值时,该嵌套函数就是一个闭包,其意义就是会记录这个值 def out(x): def inside(): print(x) return inside() out(3)
相关文章
相关标签/搜索