Generator Comprehensions

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jul 9 19:57:47 EDT 2018


Based on feedback from people annoyed at having to write "comprehensions 
and generator expressions" to refer to what ought to be a single concept, 
Guido has given the thumbs up for a documentation change to start 
referring to "generator comprehensions".


https://mail.python.org/pipermail/python-dev/2018-July/154554.html


This now combines four related syntax under one umbrella term:

Comprehension:

  - list comprehension [expr for x in values]

  - set comprehension {expr for x in values}

  - dict comprehension {key:value for x in values}

  - generator comprehension (expr for x in values) 
    a.k.a. generator expression



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson



More information about the Python-list mailing list