On 7/6/2018 9:01 PM, Terry Reedy wrote:
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.

I'm not sure if your quote above was quoting documentation, or was a suggested quote to add to the documentation, I think the latter, as Google didn't find it.

The conflict between the "Builder pattern" and "set-builder notation" can be disambiguated by consistently using the hyphenated "set-builder" (as wikipedia does). And happily, by using wikipedia terms, they would be easily found with explanations outside of python docs as well as (if this is done) inside.  We do not need

[ typ + ' builder' for typ in ('set', 'list', 'dict', 'generator')]

only set-builder.  The fencing and : determine the type of the result.  We could use

[ typ + ' form of set-builder'  for typ in ('set', 'list', 'dict', 'generator')]

in the few places where the type of the set-builder must be disambiguated, avoiding the need for the compound terms.

The result of  ( set-builder ) is a generator. We do not need the term "generator expression" or "generator comprehension".  Use "generator form of set-builder"... yes, it is one or two syllables longer, but is clearer.

A generator can be produced in one of two ways: either a function containing a yield, or a set-builder delimited by parentheses or used as an actual parameter to a function, both of which can be referred to as the "generator form of set-builder".

Glenn
_______________________________________________
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