What does read-value mean in the context of names?
In [1]: def outer():
...: x=1
...: def inner():
...: print x
...: inner()
...:
In [2]: outer()
1
Like in the above example x in not the namespace of inner()
. Do variables in namespaces have types such as read-only/ writeable etc?
Quoting official docs: "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)."
Reference: https://docs.python.org/3/tutorial/classes.html#python-scopes-and-namespaces (5 th last paragraph)