A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061742.html below:

[Python-Dev] PEP for Better Control of Nested Lexical Scopes

[Python-Dev] PEP for Better Control of Nested Lexical Scopes [Python-Dev] PEP for Better Control of Nested Lexical ScopesAlmann T. Goo almann.goo at gmail.com
Thu Feb 23 02:12:29 CET 2006
> Oddly, in Python, 'global' isn't actually necessary,
> since the module can always import itself and use
> attribute access.
>
> Clearly, though, Guido must have thought at the time
> that it was worth providing an alternative way.

I believe that use cases for rebinding globals (module attributes)
from within a module are more numerous than rebinding in an enclosing
lexical scope (although rebinding a name in the global scope from a
local scope is really just a specific case of that).  I would think
this was probably a motivator for the 'global' key word to avoid
clumsier workarounds.  Since there were no nested lexical scopes back
then, there was no need to have a construct for arbitrary enclosing
scopes.

-Almann

--
Almann T. Goo
almann.goo at gmail.com
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4