Nested function scope problem

Antoon Pardon apardon at forel.vub.ac.be
Thu Jul 27 05:42:21 EDT 2006


On 2006-07-25, Bruno Desthuilliers <onurb at xiludom.gro> wrote:
> Gerhard Fiedler wrote:
>> On 2006-07-25 04:06:24, Steve Holden wrote:
>> 
> Since Python has no "local variable declaration", there must be a rule
> to distinguish local names from names living in the enclosing
> namespaces. The rule is: unless previously declared 'global' (ie
> module-level) with the appropriate statement, any name bound in the
> local namespace is local. If declared 'global', it has to exist in the
> global namespace.
>
> This was much more simple to understand when we didn't have nested
> functions - we mostly had global and local scope.

But having only a global an local scope, didn't prevent nested
functions. The nested functions just didn't have nested scopes
and that had it's own problems.

-- 
Antoon Pardon



More information about the Python-list mailing list