[Python-Dev] zip() and list-comprehension with commas

Ka-Ping Yee ping@lfw.org
Wed, 12 Jul 2000 03:14:54 -0700 (PDT)


On Wed, 12 Jul 2000, Paul Prescod wrote:
> 
> The easy way to avoid the ambiguity is to dump the comma and use colons
> as Guido intended.
> 
> [for x in list1:
> 	 if x > 1:
> 		 for y in list2:
> 			 if y > 2:
> 				(x,y)]

Does indentation matter, and are you proposing blocks of
"real" code in there?  I suspect that writing it this way
is going to tempt people to include more code, maybe expect
to be able to write "else" clauses, put in "break", etc.

I think if you do it this way, the above is so close to how
you'd write it without list comprehensions that it largely
eliminates the succinctness that motivated list comprehensions
in the first place.


-- ?!ng