[Python-bugs-list] Iterator doesn't re-evaluate with a dynamically resizing list (PR#178)

tim_one@email.msn.com tim_one@email.msn.com
Tue, 11 Jan 2000 23:31:10 -0500 (EST)


[Sean Jensen-Grey, mutating a list while iterating over it]
> ...
> # is this expected behavior?

Yes indeed.  See the Language Reference Manual, section "The 'for'
statement".

Change, e.g.,

    for x in l_sync:

to

    for x in l_sync[:]:

if that's not the behavior you want.