[Tutor] if value in list of dictionaries

Steven D'Aprano steve at pearwood.info
Tue Sep 28 23:33:56 CEST 2010


On Wed, 29 Sep 2010 01:41:22 am Peter Otten wrote:

> You should never iterate over a list or dictionary and add or remove
> items to it at the same time. That is a recipe for disaster even if
> it doesn't fail explicitly*
[...]

> (*) I'll leave it to Steven D'Aprano to add the fine print ;)


I'll be satisfied if you merely add the word "almost" between "should" 
and "never" :)



-- 
Steven D'Aprano


More information about the Tutor mailing list