Python v3.1.2 documentation question

Stephen Hansen me+list/python at ixokai.io
Tue Jun 29 13:21:14 EDT 2010


On 6/29/10 10:01 AM, Ethan Furman wrote:
> In the glossary section it states:
>
> <doc>
> nested scope
>
> The ability to refer to a variable in an enclosing definition. For
> instance, a function defined inside another function can refer to
> variables in the outer function. Note that nested scopes work only for
> reference and not for assignment which will always write to the
> innermost scope. In contrast, local variables both read and write in the
> innermost scope. Likewise, global variables read and write to the global
> namespace.
> </doc>
>
> Doesn't the nonlocal keyword make variables in outer scopes writable?

Yes. I'd submit a doc bug.

-- 

    ... Stephen Hansen
    ... Also: Ixokai
    ... Mail: me+list/python (AT) ixokai (DOT) io
    ... Blog: http://meh.ixokai.io/




More information about the Python-list mailing list