Nested scopes hitch

Duncan Booth duncan at NOSPAMrcp.co.uk
Mon Apr 8 07:20:41 EDT 2002


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().

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list