[Python-Dev] Lockstep iteration - eureka!

Guido van Rossum guido@beopen.com
Wed, 09 Aug 2000 07:49:43 -0500


> On Wed, 9 Aug 2000, Greg Ewing wrote:
> > 
> >    for (x in a, y in b):
> >       ...

No, for exactly the reasons Ping explained.  Let's give this a rest okay?

> I would much rather petition now to get indices() and irange() into
> the built-ins... please pretty please?

I forget what indices() was -- is it the moreal equivalent of keys()?
That's range(len(s)), I don't see a need for a new function.  In fact
I think indices() would reduce readability because you have to guess
what it means.  Everybody knows range() and len(); not everybody will
know indices() because it's not needed that often.

If irange(s) is zip(range(len(s)), s), I see how that's a bit
unwieldy.  In the past there were syntax proposals, e.g. ``for i
indexing s''.  Maybe you and Just can draft a PEP?

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)