[Python-Dev] list comprehensions again...

Gordon McMillan gmcm@hypernet.com
Tue, 11 Jul 2000 21:58:02 -0400

Ka-Ping Yee wrote:

> On Tue, 11 Jul 2000, Greg Stein wrote:

> > for x, y in a, b:
> > 
> > won't work. "a, b" is a tuple constructor. The for-loop will
> > iterate over a two-item tuple, and unpack each item (a and b)
> > into the x,y variables.
> That's why i suggested the above, with semicolons instead of
> commas. Other ideas for a separator symbol are welcomed... but i
> think the semicolon may be the only reasonable option left.

for x, y in a, b: 
 <one result>
for x, y in a; b:
 <completely different result>

speechless-ly y'rs

- Gordon