[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
tim.peters at gmail.com
Tue Jul 3 02:42:50 EDT 2018
> > However, generator expressions ( why don’t we call them generator
> > comprehensions?)
Because nobody really liked the "iterator comprehensions" or "accumulator
displays" they were variously called at the start.
As that explains, "generator expressions" was an attempt to break away from
that "comprehensions" was always a dubious term, carried over from set
theory where the term focuses on the optional "if" part rather than the
more fundamental iterator or computation parts.
At the start, for some (forgotten by me) reason it seemed important to make
a distinction between "things like this" that were evaluated at once (list,
dict, and set comprehensions) and the new-fangled accumulator displays that
got evaluated lazily. But the "generator" in "generator comprehensions"
would really be enough all by itself to make that clear enough.
So if we had it to do over again I'd sigh and accept "generator
comprehensions" anyway. It's been an eternal PITA - and especially in the
PEP 572 threads! - to keep typing "comprehensions or generator
expressions". Then again, if I had the power of Guido's time machine, I'd
go back more, and not use "comprehensions" for anything to begin with.
Instead we'd have list, dict, set, and generator twizzlers, affectionately
called listwiz, dictwiz, setwiz, and gentwiz by the cool kids :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev