a break for comprehensions

Steven D. Majewski sdm7g at Virginia.EDU
Mon Jul 30 13:52:24 EDT 2001


On 30 Jul 2001, Paul Svensson wrote:

> In my view, it should obviously end the whole thing; but then I
> never see list comprehensions a procedural description for how
> to generate the list, but rather a symbolic description of
> the list content.  With that view it shouldn't matter which
> for-clause gets evaluated innermost, and so the only unambigous
> thing for the while clause to end, is the whole comprehension.

You hit the nail on the head there, Paul!

The 'while' clause seems useful, and I don't see anything inherently
ambiguous about it, but sticking a procedural clause into what's
otherwise a declarative seens to go against the spirit -- what's 
nice about list comprehensions is that they are just like set 
notations. ( well -- the left hand side is often procedural -- it 
would be even more readable if it were more clearly separated
with a "where" clause, but that would be Yet Another Keyword... ) 

-- Steve Majewski






More information about the Python-list mailing list