Alternative iterator syntax

Aahz Maruch aahz at
Wed Feb 21 21:29:35 CET 2001

In article <m31ysru8ws.fsf at>,
Michael Hudson  <mwh21 at> wrote:
>Nah, reset the allocator every time item 0 is asked for.  I'd have to
>admit I haven't read Huaiyu Zhu's proposal carefully enough to be sure
>this would work, but something like this ought to be possible, I'd
>have thought.
>I mean,
>l = range(10)
>for i in l:
>   # do some stuff
>for i in l:
>   # do some other stuff
>will have to do something along these lines, no?

Nope.  In Huaiyu's proposal, l will be a real list and each of the two
for loops will create a new iterator.
                      --- Aahz (Copyright 2001 by aahz at

Androgynous poly kinky vanilla queer het    <*>
Hugs and backrubs -- I break Rule 6

The problem with an ever-changing .sig is that you have to keep changing it

More information about the Python-list mailing list