A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-August/141250.html below:

[Python-Dev] About closures creates in exec

[Python-Dev] About closures creates in exec [Python-Dev] About closures creates in execAndrea Griffini agriff at tin.it
Wed Aug 12 21:05:50 CEST 2015
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>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4