[Python-3000] Parallel iteration syntax
steven.bethard at gmail.com
Tue Mar 28 19:42:34 CEST 2006
On 3/27/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 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):
I assume this would be exactly equivalent to::
for x, y in zip(iter1, iter2):
where zip is actually izip since we're talking Python 3000?
I'm -1, at least until I see some code that's substantially improved
by the syntax. The zip version isn't that complicated -- you just
need to understand how zip works. And zip has a variety of other
use-cases, so any consistent user of Python should get themselves
familiar with it.
Grammar am for people who can't think for myself.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000