Why read-only nested scopes?

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Sep 5 04:42:24 EDT 2002


martin at v.loewis.de (Martin v. Loewis) wrote in 
news:m3bs7da0zs.fsf at mira.informatik.hu-berlin.de:

>> OTOH, if "everything is an object," then the namespace of
>> an enclosing scope could also be an object, and as such
>> could support rebinding of names therein ;-)
> 
> It is an object - the frame object. There is just no easy way to refer
> to that object.

And don't forget that when the nested function is called the frame object 
may no longer exist: nested scope variables can continue to exist after the 
frame in which they were created has been destroyed.

-- 
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