Re: [Python-Dev] About closures creates in exec

2015-08-12 Thread R. David Murray
On Wed, 12 Aug 2015 21:05:50 +0200, Andrea Griffini wrote: > Is it intended that closures created in exec statement/function cannot see > locals if the exec was provided a locals dictionary? > > This code gives an error ("foo" is not found during lambda execution): > > exec("def foo(x): retu

[Python-Dev] About closures creates in exec

2015-08-12 Thread Andrea Griffini
Is it intended that closures created in exec statement/function cannot see locals if the exec was provided a locals dictionary? This code gives an error ("foo" is not found during lambda execution): exec("def foo(x): return x\n\n(lambda x:foo(x))(0)", globals(), {}) while executes normally w