[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

Terry Reedy tjreedy at udel.edu
Tue Jul 3 18:04:35 EDT 2018


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 <other computer 
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




More information about the Python-Dev mailing list