On 3 March 2018 at 10:09, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Nick Coghlan wrote:
I don't think it should be possible to close over statement locals.

Why not?

I gave a more detailed answer to that in https://mail.python.org/pipermail/python-ideas/2018-March/049138.html, but the short version is:

* prohibiting closing over them opens up a lot of opportunities to simplify the implementation
* prohibiting closing over them increase their semantic distance from regular function locals, making it easier for people to answer the question "Should I use a function local or a statement local?" in the future

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan@gmail.com   |   Brisbane, Australia