[issue15214] list.startswith() and list.remove() fails to catch consecutive items in a list.

2012-06-27 Thread Isaac
New submission from Isaac isaacloves2...@yahoo.com: The simple repro below, shows that if a list of strings has two consecutive items that begin with the same letter, an iteration over the list to find and remove all strings that start with that letter fails. The second string that starts

[issue15214] list.startswith() and list.remove() fails to catch consecutive items in a list.

2012-06-27 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: This happens because you modify the list while iterating over it, which makes the loop not work as you expect. Essentially, when you remove the item that's currently being pointed to, the loop skips over the next item. An idiomatic way to