(original) (raw)
I smell a new thread. :-)
On Tue, Jul 3, 2018 at 3:06 PM Terry Reedy <tjreedy@udel.edu> wrote:
On 7/3/2018 2:42 AM, Tim Peters wrote:
\> So if we had it to do over again I'd sigh and accept "generator
\> comprehensions" anyway. It's been an eternal PITA - and especially in
\> the PEP 572 threads! - to keep typing "comprehensions or generator
\> expressions". Then again, if I had the power of Guido's time machine,
\> I'd go back more, and not use "comprehensions" for anything to begin
\> with.
Amen. I cannot make 'comprehension' in this context comprehensible
without some linguistic twisting.
\> Instead we'd have list, dict, set, and generator twizzlers,
\> affectionately called listwiz, dictwiz, setwiz, and gentwiz by the cool
\> kids :-)
I learned the set notion, such as
{n^2: n in N; 1 <= n < 100, n even} # math
{n\*n for n in range(1,100) if not n%2} # python
as 'set builder' notation.
If we had followed the math precedent, instead of language>, we would have set builders, list builders, dict builders, and
generator builders.
I half seriously think we should consider this for 3.8 for the benefit
of future Python programmers as well as ourselves. Comprehensions that
can contain assignment expressions are a slightly new thing.
\--
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/guido%40python.org
--
--Guido van Rossum (python.org/\~guido)