Nested scopes hitch

Jeremy Hylton jeremy at alum.mit.edu
Mon Apr 8 12:37:55 EDT 2002


weeks at vitus.scs.agilent.com (Greg Weeks) wrote in message news:<1018044224.815568 at cswreg.cos.agilent.com>...
> One way to put it is this: Python 2.2 did not create nested scopes (they've
> always been there) or make nested scopes visible in function/method code.
> It simply *increased* the visibility of nested scopes beyond the original
> visibility of local+global.  How much is it increased?  Well, gee, I
> forget.  (I guess the language is getting too big for me.)

It enlarged the environment in which free variables were resolved from
the global scope to the scope of all enclosing function blocks.  I
hope that isn't too much to remember :-).
 
> Anyway, it increased visibility enough so that it is no longer possible to
> call a function and pass it the scope as two dictionaries, which I had 
> found handy on occasion.

I'm not sure I follow the details here, but I don't see how the change
in the scope rules would affect a function unless it specifically
exploited nested scopes.  If you wrote a function that only uses
locals and globals, can you not call it just the way you always did?

Jeremy



More information about the Python-list mailing list