Alternative iterator syntax

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


In article <m31ysru8ws.fsf at atrus.jesus.cam.ac.uk>,
Michael Hudson  <mwh21 at cam.ac.uk> 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 pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
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