osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...]


On Fri, Jul 6, 2018 at 4:19 PM Terry Reedy <tjreedy at udel.edu> wrote:

> Since Guido, the first respondent, did not immediately shoot the idea
> down, I intend to flesh it out and make it more concrete.
>

Maybe I should have shot it down. The term is entrenched in multiple
languages by now (e.g. https://en.wikipedia.org/wiki/List_comprehension).
Regarding "list builder" one could argue that it would just add more
confusion, since there's already an unrelated Builder Pattern (
https://en.wikipedia.org/wiki/Builder_pattern) commonly used in Java.
(Though I worry about the presence of a Python example in that Wikipedia
page. :-)

Also, "generator builder" is not much more expressive than "generator
expression", and the key observation that led to this idea was that it's
such a mouthful to say "comprehensions and generator expressions". Maybe
it's not too late to start calling the latter "generator comprehensions" so
that maybe by the year 2025 we can say "comprehensions" and everyone will
understand we mean all four types?

FWIW more people should start using "list display" etc. for things like [a,
b, c].

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180706/9de1dc2a/attachment.html>