On 9/1/06, Greg Ewing <[EMAIL PROTECTED]> wrote:
> Guido van Rossum wrote:
> > I would just rip it out.
>
> I don't understand this business about ripping out
> exec. I thought that exec had to be a statement so
> the compiler can tell whether to use fast locals.
> Do you have a different way of handling that in mind
> for Py3k?
Yes. If we implement the module-level analysis it should be easy
enough to track whether 'exec' refers to the built-in function. (We're
already planning to add some kind of prohibition against outside
modules poking new globals into a module that shadow built-ins.)
But I also see no bones in requiring the use of a dict arg if you want
to observe the side effects of the exec'ed code. So instead of
def f(s):
exec s
print a # presumably s must contain an assignment to a
you'd have to write
def f(s):
ns = {}
exec(s, ns)
print ns['a']
This makes it a lot clearer what happens IMO.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com