mongodb-labs / edda

A log visualizer for MongoDB - This Repository is NOT a supported MongoDB product
232 stars 28 forks source link

[cleanup] undefined behavior #67

Closed kchodorow closed 12 years ago

kchodorow commented 12 years ago

You're removing an element while iterating over a list here: https://github.com/kchodorow/logl/blob/master/logl/post/event_matchup.py#L284, which has undefined behavior. Use http://docs.python.org/tutorial/datastructures.html#the-del-statement to remove a instead.

kchodorow commented 12 years ago

From Randall:

you can also do this: for i in x[:]: x.remove(i) x[:] returns a copy of the list so you are removing elements from the original list but iterating over a copy.

samantharitter commented 12 years ago

that sounds safer