On 9/1/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > I would just rip it out. > > It turns out that it's not so easy. The exec statement currently can > modify the locals, which means that > > def f(): > exec "a=1" > print a > > succeeds. To make that possible, the compiler flags scopes containing > exec statements as unoptimized and does not assume unbound names to > be global. > > With exec being a function, currently the above function won't work > because "a" is assumed to be global. > > I can see only two resolutions: > > * change exec() semantics so that it cannot modify the locals > * do not make exec a function
Make it so it can't modify the locals. execfile() has the same limitation. -- --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
