> 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 [EMAIL PROTECTED] _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com