On Mon, Jul 2, 2018 at 11:42 PM, Tim Peters <tim.peters@gmail.com> wrote:
"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.

I always wondered about that :-) -- I'd say for most of us that aren't familiar with set theory, it's kind of a "sounds something like putting thing together" word and I just left it at that, and learned what they are.
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". 

Well, too late to change the official name, but not too late to start using the term in threads like these -- and other documentation, etc....

I find there is a lot of confusion about the word "generator", as it implies a "thing that generates values on the fly" (like, say the range() object.

But then, in Python, a generator is something that gets crated by a generator function, and CAN be an "thing (iterator) that generates things on the fly", but can also be a more generic coroutine, and can be used in nifty ways that really have nothing to do with generating a bunch of value. (like pytest fixtures, for example)

So we have generators, iterators, and iterables, and generators can be iterators, but aren't always, and any number of iterators can generate values on the fly, and ....

so it's all a bit of a mess to explain to a newbie.

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 :-)

I'd like that!



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception