[Python-3000] Parallel iteration syntax
Giovanni Bajo
rasky at develer.com
Tue Mar 28 16:52:55 CEST 2006
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> for (x in iter1, y in iter2):
> ...
Contrary to zip()/izip(), this does not easily allow further composition, as
far as I can tell. For instance:
for i,(x,y) in enumerate(izip(iter1, iter2)):
...
must be translated to:
for (i,x in enumerate(iter1), y in iter2):
or:
for (x in iter1, i,y in enumerate(iter2)):
both of which require one further mental step, if you're coming from:
i = 0
for (x in iter1, y in iter2):
...
i += 1
--
Giovanni Bajo
More information about the Python-3000
mailing list