Message260933
From the 9.2. Python Scopes and Namespace section:
> If a name is declared global, then all references and assignments go directly to the middle scope containing the module’s global names. To rebind variables found outside of the innermost scope, the nonlocal statement can be used; if not declared nonlocal, those variable are read-only (an attempt to write to such a variable will simply create a new local variable in the innermost scope, leaving the identically named outer variable unchanged).
This terminology is extremely confusing to newcomers; see https://stackoverflow.com/questions/35667757/read-only-namespace-in-python for an example. Variables are never read-only. The parent scope name simply is *not visible*, which is an entirely different concept. Can this section be re-written to not use the term 'read-only'? |
|
Date |
User |
Action |
Args |
2016-02-27 09:15:41 | mjpieters | set | recipients:
+ mjpieters |
2016-02-27 09:15:41 | mjpieters | set | messageid: <1456564541.09.0.218031979167.issue26449@psf.upfronthosting.co.za> |
2016-02-27 09:15:41 | mjpieters | link | issue26449 messages |
2016-02-27 09:15:40 | mjpieters | create | |
|