Reid Kleckner wrote:

If I remember correctly, the exec statement is going away in py3k, and
calling exec() with one argument can modify the local scope.

I've been kind of wondering what the deal is with exec in py3.
I always thought the reason for making exec a statement was so
that locals optimisation could be turned off in its presence,
so I'm not sure how py3 is getting away with making it a
function.

Anyhow, it seems to me that as long as locals() or whatever
might replace it is able to find the existing value of a local,
it should also be able to change that value, wherever it
happens to be stored.

I suppose that might fail if an optimiser decides to keep
multiple copies of a local for some reason, though.

But even if it has to be read-only, I still think a view object
would be a more py3ish way of handling locals() and the like.
You might only want access to a few locals, in which case
building a dict containing all of them would be wasteful.

--
Greg


--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to