[Python-Dev] Lockstep iteration - eureka!

Thomas Wouters thomas@xs4all.net
Wed, 9 Aug 2000 13:06:45 +0200


On Wed, Aug 09, 2000 at 04:39:30PM +1000, Mark Hammond wrote:

> >    for (x in a, y in b):
> >       ...

> Hmmm.  Until someone smarter than me shoots it down for some obvious reason
> <wink>, it certainly appeals to me.

The only objection I can bring up is that parentheses are almost always
optional, in Python, and this kind of violates it. Suddenly the presence of
parentheses changes the entire expression, not just the grouping of it. Oh,
and there is the question of whether 'for (x in a):' is allowed, too (it
isn't, currently.)

I'm not entirely sure that the parser will swallow this, however, because
'for (x in a, y in b) in z:' *is* valid syntax... so it might be ambiguous.
Then again, it can probably be worked around. It might not be too pretty,
but it can be worked around ;)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!