[Python-Dev] list comprehensions again...

Guido van Rossum guido@beopen.com
Tue, 11 Jul 2000 09:40:32 -0500

>    [x,y for x in (1,2,3) for y in (4,5,6)]

Hm, I suppose the programmer meant the same as

    [(x,y) for x in (1,2,3) for y in (4,5,6)]

Would it be really bad if we forced them to write it that way?

Side note: the suggested syntax here (for i in seq1 for j in seq2)
looks like a potential alternative for the currently proposed parallel
for loop syntax (for i in seq1; j in seq2).

Only problem: the for-for variant could be mistaken by someone used to
see nested loops as meaning the same as

    for i in seq1:
	for j in seq2: ...

Undecided and unhelpful,

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)