[Python-Dev] Re: closure semantics

Guido van Rossum guido at python.org
Thu Oct 23 18:08:58 EDT 2003


> However, as long as we're talking about this stuff, I wish I could
> write "global foo" at module scope and have that mean "this variable
> is to be treated as global in all functions in this module".

This is similar to Greg Ewing's proposable to have 'rebindable x' at
an outer function scope.  My problem with it remains:

It gives outer scopes (some) control over inner scopes.  One of the
guidelines is that a name defined in an inner scope should always
shadow the same name in an outer scope, to allow evolution of the
outer scope without affecting local details of inner scope.  (IOW if
an inner function defines a local variable 'x', the outer scope
shouldn't be able to change that.)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list