[Python-ideas] About list comprehension syntax

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 31 05:05:52 CEST 2007


Arnaud Delobelle wrote:

> Why not just drop the 'x for' at the start of a 'filter  
> comprehension' (or generator expression)?  Thus (3) could be written  
> more simply as:
> 
> (3') [x in L if p(x)]

It would be very nice, but could be difficult to parse,
because there's no clue you're not looking at a normal
list constructor until you get to the 'if'.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Python-ideas mailing list