Generator Comprehensions

Steven D'Aprano steve+comp.lang.python at
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".

This now combines four related syntax under one umbrella term:


  - 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