[Python-Dev] List comprehension syntax (Features for Python 2.0)

Trent Mick trentm@ActiveState.com
Tue, 25 Jul 2000 11:00:00 -0700


On Tue, Jul 25, 2000 at 06:59:55PM +0200, M . -A . Lemburg wrote:
> Wouldn't it make much more sense to write something
> more lambda function like, e.g.
> 
>     [for (x,y) in zip([10,20,30], [1,2,3]): x+y]

or

[for x in [10,20,30]: for y in [1,2,3]: x+y]

> 
> or
> 
>     [for x in range(100): x*2]
> 
<snip>

> List comprehension would then become something like:
> 
>     [for <vars> in <expr>: <evaluated expr>]
> 

For what it is worth, I like that. I can easily digest either though, so I
think that this is a question for user testing.

Trent

-- 
Trent Mick
TrentM@ActiveState.com