On Mon, 3 May 2010 05:35:52 pm Andre Engels wrote:

> Don't change the list that you are iterating over. As you have found,
> it leads to (to most) unexpected results. 

Or if you absolutely have to change the list in place, iterate over it 
*backwards* (starting at the end, and moving towards the beginning), so 
that the changes only happen in the part of the list you've already 
seen.



-- 
Steven D'Aprano
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to