[Python-Dev] List comprehensions
Tim Peters
tim.one@comcast.net
Wed, 26 Jun 2002 19:29:42 -0400
[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".