[Python-ideas] Order of loops in list comprehension

Sven R. Kunze srkunze at mail.de
Fri Oct 21 13:33:00 EDT 2016


On 21.10.2016 01:43, Greg Ewing wrote:
> Alexander Heger wrote:
>> For me the current behaviour does not seem unreasonable as it 
>> resembles the order in which you write out loops outside a comprehension
>
> That's true, but the main reason for having comprehensions
> syntax in the first place is so that it can be read
> declaratively -- as a description of the list you want,
> rather than a step-by-step sequence of instructions for
> building it up.
>
> If you have to stop and mentally transform it into nested
> for-statements, that very purpose is undermined.
>

Exactly.


Sven


More information about the Python-ideas mailing list