Please improve these comprehensions (was meaning of [ ])

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Sep 6 01:51:35 EDT 2017


On Tue, 05 Sep 2017 19:07:32 -0700, Rustom Mody wrote:

> Also noteworthy here: You know more about list comprehensions than their
> inventor — Greg Ewing 

And many people know more about General Relativity than Albert Einstein. 
What's your point?


> [No I normally would not call Greg their inventor

You shouldn't, because he didn't invent them. They existed in Haskell, 
which is where Greg learned about them, and even Haskell did not invent 
them. In fact, Greg merely *proposed* that they be added to Python. He 
didn't write the PEP that specified their behaviour, and the PEP 
specifies behaviour which Greg does not approve of.

Namely that comprehensions are *explicitly* intended as semantically 
equivalent to a for-loop, plus accumulator.

Greg may have been the first to propose comprehensions in Python, but 
that doesn't give him any special insight into their behaviour, and it 
certainly doesn't make him their inventor.


> but in this case following through your logic that python exists in a
> historical, contextual vacuum]

I never said that.



-- 
Steven D'Aprano
“You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.” —Theo de Raadt



More information about the Python-list mailing list