[Python-Dev] nonlocals() function?

Steve Bonner pythonsteve at gmail.com
Sat Apr 3 13:16:47 CEST 2010


What do we think of adding a built-in nonlocals() function that would
be similar to globals() and locals()?  Like those functions, it would
return a dictionary of variable names and their values. Since we now
have the nonlocal statement, it would be consistent to keep the
three scopes local/nonlocal/global with parallel capabilities. And it
might sometimes be useful for code inside a nested function to see
what variables are available at the enclosing level.

Steve Bonner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100403/f75c68df/attachment.html>


More information about the Python-Dev mailing list