[Python-ideas] global and nonlocal with atributes

Yuval Greenfield ubershmekel at gmail.com
Sat May 4 20:03:33 CEST 2013


On 4 May 2013 19:48, "João Bernardo" <jbvsmo at gmail.com> wrote:
> These should generate the same "LOAD_GLOBAL" and "LOAD_DEREF" bytecodes,
so "global" and "nonlocal" will not be objects nor passed as arguments.
>
> That way you can have both "global.x", "nonlocal.x" and "x" variables
without conflict.
>

I think the best language would work like that. But having more than one
way to do it is bad for your health. So perhaps this can be the new way to
do it in python 4. I'd also expect "global" to be iterable i.e. replacing
"globals()".

Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130504/4907b24f/attachment.html>


More information about the Python-ideas mailing list