[Python-Dev] closure semantics

Barry Warsaw barry at python.org
Tue Oct 21 21:55:36 EDT 2003


On Tue, 2003-10-21 at 20:20, Guido van Rossum wrote:
> > Another idea: We could replace the function globals() with an object
> > that provides __call__ for backwards compatibility, but also has a
> > special __setattr__. Then global assignment would be 'globals.x = 23'.
> > Would this be possible?
> 
> Yes, I just proposed this in my previous response. :-)

So maybe the idea of using function attributes isn't totally nuts, if
you use a special name.  E.g. outer.__locals__.x and outer.__globals__.x
-Barry


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20031021/6088ac50/attachment.bin


More information about the Python-Dev mailing list