Python v3.1.2 documentation question

E

Ethan Furman

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?

~Ethan~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top