Python变量查找LEGB原则

两种类型 首先要知道Python的基本数据类型分为2种,可变以及不可变类型。 可变类型list dict set 不可变类型 number tuple stringpython 变量访问 LEGB L-Local(function);函数内的名字空间 E-Enclosing function locals;外部嵌套函数的名字空间(例如closure) G-Global(module);函数定义所在
相关文章
相关标签/搜索