Nested scopes hitch

Greg Weeks weeks at vitus.scs.agilent.com
Mon Apr 8 15:33:36 EDT 2002


Duncan Booth (duncan at NOSPAMrcp.co.uk) wrote:
: weeks at vitus.scs.agilent.com (Greg Weeks) wrote in
: news:1018044224.815568 at cswreg.cos.agilent.com: 

: > 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 don't think this is correct.
: If your function accesses variables in a nested scope, then those variables 
: are present in the dictionary locals().

I don't have the documentation or a Python 2.1 handy.  But I did originally
copy from the documentation the text:

    Names in class scope are not accessible.

    Under this proposal, it will not be possible to gain
    dictionary-style access to all visible scopes.

My interpretation of this is that visible bindings from an intermediate
scope will be in neither globals() nor locals().


Greg



More information about the Python-list mailing list