Generator Comprehensions

Aahz Maruch aahz at panix.com
Tue Jan 29 20:06:56 EST 2002


In article <mailman.1012343631.21004.python-list at python.org>,
Tim Peters <tim.one at home.com> wrote:
>
>That's not an excuse, it was the design.  Python didn't even have nested
>scopes (in 2.2's sense) when listcomps were introduced, and it would have
>been horribly inconsistent if one and only one binding construct did not
>make its target name(s) local wrt to its scope.  Had nested scopes been
>there at the time, it would have been more palatable to say that listcomps
>define a new scope -- but that would have been a surprise of a different
>kind (not to people coming from FP languages, but Python is not an FP
>language, and won't become one before Guido's death <wink>).

Um, as someone who is *not* a functionally-minded person, I can easily
argue the surprise factor both ways, particularly given the C++
capability of introducing a local scope at any point.  I think the way
listcomps currently work was probably the best decision, but <shrug>.
-- 
                      --- Aahz  <*>  (Copyright 2002 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"I support family values -- Addams family values" --www.nancybuttons.com



More information about the Python-list mailing list