[Python-Dev] Advice in stat.py

Guido van Rossum guido@zope.com
Sun, 29 Jul 2001 18:40:22 -0400


> > > >>> def spam(x,y):
> > > ...      exec y
> > > ...      def eggs():
> > > ...          print x
> 
> > That one is just fine I think.
> 
> Why is 'import *' inside a function fine, but a bare exec isn't ? Weren't
> you going to deprecate bare exec's altogether ?

You mean the other way around don't you?  I proposed a warning for
import * but not for bare exec.  I guess for me the difference is that
import * is just stupid (potentially lots of work going on every time
you call the function) while the main problem with bare exec is that
it gets in the way of optimizers and the like.  Since we don't have an
optimizer (yet) I don't care so much (yet).

--Guido van Rossum (home page: http://www.python.org/~guido/)