Python nonlocal statement

前端 未结 9 1260
我在风中等你
我在风中等你 2020-11-22 03:52

What does the Python nonlocal statement do (in Python 3.0 and later)?

There\'s no documentation on the official Python website and help(\"nonloca

9条回答
  •  深忆病人
    2020-11-22 04:40

    In short, it lets you assign values to a variable in an outer (but non-global) scope. See PEP 3104 for all the gory details.

提交回复
热议问题