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

Trent Mick trentm@activestate.com
Wed, 26 Jul 2000 09:37:26 -0700


On Wed, Jul 26, 2000 at 02:59:14PM +1200, Greg Ewing wrote:
> Trent Mick suggested:
> 
> > [for x in [10,20,30]: for y in [1,2,3]: x+y]
> 
> When designing the syntax, I decided to put the target
> expression first, because I wanted it to read declaratively.
> Also I think it's clearer when you can see right up front
> what it's going to be a list *of*.
> 

Yes, I expressed liking someones (MAL's? Skip's?) suggested:
  [for x in [1,2,3]: x]
Over the currently favoured
  [x for x in [1,2,3]]

However, given Tim's response to that thread (list comprehensions are
declarative, the important thing is for the synxtax to be memorable after
initial familiarity), I am inclined to retract my opinion and support:
  [x for x in [1,2,3]]
and its ilk.


Mainly, I don't want to get pulled into the debate. It has been debated and
there are too many cooks in the kitchen.

Trent

-- 
Trent Mick
TrentM@ActiveState.com