comprehensions was Re: Switch statements again

A. Lloyd Flanagan alloydflanagan at attbi.com
Mon Jan 20 19:25:49 CET 2003


Hmmm....
making list comprehension variables local to the comprehension: +1
providing a way to 'break out' of comprehension in the middle: -1

The whole point of using a list comprehension, I think, is that it
allows you to think of the operation in terms of operations on sets,
and not as a loop.  If you add syntax to break in the middle, you're
back to thinking about loops, in which case you're better off with an
explicit loop construct.

Come to think of it, it should be very easy to break list
comprehensions into parallel operations on a multiprocessor machine. 
That seems like something worth preserving.




More information about the Python-list mailing list