python: global v.s. nonlocal
2017-12-06 本文已影响0人
庞贝船长
-
Nonlocal
Nonlocal is similar in meaning toglobal
. But it takes effect primarily in nested methods. It means "not a global or local variable." So it changes the identifier to refer to an enclosing method's variable.
相关栗子阅读:
- global, nonlocal
- stackoverflow 上的问题: Python nonlocal statement