[Python-Dev] About closures creates in exec
Andrea Griffini
agriff at tin.it
Wed Aug 12 21:05:50 CEST 2015
More information about the Python-Dev mailing list
Wed Aug 12 21:05:50 CEST 2015
- Previous message (by thread): [Python-Dev] [low-pri] Changing my email address
- Next message (by thread): [Python-Dev] About closures creates in exec
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 with
exec("def foo(x): return x\n\n(lambda x:foo(x))(0)")
Is this the expected behavior? If so where is it documented?
Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150812/1f9ab8ac/attachment.html>
- Previous message (by thread): [Python-Dev] [low-pri] Changing my email address
- Next message (by thread): [Python-Dev] About closures creates in exec
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list