list comprehension question

Arnaud Delobelle arnodel at
Fri May 1 19:52:30 CEST 2009

Emile van Sebille <emile at> writes:

> On 5/1/2009 9:19 AM Arnaud Delobelle said...
>> Emile van Sebille <emile at> writes:
>>> On 5/1/2009 7:31 AM J Kenneth King said...
>>>> I love comprehensions, but abusing them can lead to really dense and
>>>> difficult to read code.
>>> I disagree on dense and difficult, although I'll leave open the
>>> question of abuse.
>>> b = [ item for pair in a for item in pair ]
>>> This is exactly the code above expressed in comprehension form.
>> If the comprehension above is an abuse, then every nested list
>> comprehension is an abuse of comprehensions so they might as well not be
>> in the language...
> I hope you didn't understand me to say that this usage is abuse.

Emile: sorry, the way I was quoting earlier posts was unclear.  I was
refering to the post you quoted in your message, which describe the
nested list comprehension as abuse.  As supporting evidence for my reply
I included your example of nested list comprehension, which is one of
the simplest possible ones one can think of.


More information about the Python-list mailing list