[Gerald S. Williams, on listcomp (non)scopes] > No problem. As long as it was decided that there's a use for > the current behavior, I won't question it. I'm not sure there's a use for it, but I am sure I'd shoot any coworker who found one and relied on it <wink>. Python didn't have lexical scoping at the time listcomps were getting hammered out, and it would have been nuts to introduce a "local scope" for a single, isolated construct. Then and now, the semantics of listcomps can be exactly explained via a straightforward transformation to a for-loop. Now that we have lexical scoping, a local index vrbl would also be easy to explain -- but it would be "a change".
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