[Python-3000] Parallel iteration syntax
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Mar 28 07:04:29 CEST 2006
Some years ago there was a long discussion about extending
the for-loop to express parallel iteration over a number
of iterables, which ended with the conclusion that such
an extension was syntactically impossible, and the creation
of zip().
Slightly too late for consideration, I did come up with
what I believe is a backwards-compatible syntax extension
to support this:
for (x in iter1, y in iter2):
...
This is currently a syntax error, so there is no clash
with existing semantics.
I'm mentioning it here again just in case anyone wants
to consider it for Py3k. I still believe it would be
nice to have a direct syntax for parallel iteration
to avoid the overhead of using zip or iterzip.
Also I think the above is easier to read, because it
puts each variable next to the relevant expression.
Greg
More information about the Python-3000
mailing list