In response to Guido's reply to my post fleshing out my idea to use 'generator|list|set|dict builder',
On 7/6/2018 7:58 PM, Ivan Pozdeev via Python-Dev wrote:

According to https://en.wikipedia.org/wiki/List_comprehension#History, the term's known from at least 1977 and comes from such influential languages as NPL, Miranda and Haskell. So it's not you to blame for it :-)

"A list comprehension is a syntactic construct available in some programming languages for creating a list based on existing lists. It follows the form of the mathematical set-builder notation (set comprehension) as distinct from the use of map and filter functions."

Mathematicians do not always agree on terminology and notation. I believe that 'set builder notatation' is both older and was and perhaps is more widespread than 'set comprehension'. I have read that it is at least a century old. But
https://en.wikipedia.org/wiki/Set-builder_notation
does not seem to be the place

In any case, Python's comprehensions use an English-syntax version of extended set builder notation. "In Python, the set-builder's braces are replaced with square brackets, parentheses, or curly braces, giving list, generator, and set objects, respectively. Python uses an English-based syntax."

Also, "generator builder" is not much more expressive than "generator expression",

I looked for an alternative 'x' to 'comprehension' such that 'generator|list|set|dict x' works and is specific to the notation. 'Builder' is a reasonable choice.

'expression' is way too general. A 'list expression', for instance, is any expression that evaluated to a list. In this context, I consider that the specific term 'says more' than the general term.

On the face of it, a generator expression is an expression that evaluates to a generator. In this sense, 'f(args)', where f is a generator function, is a generator expression. In any case, 'generator comprehension' is an awkward 8 syllable mouthful.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to