Hans Mulder <hansmu at xs4all.nl> writes: > How about: > changes = filter(is_bad, d) > Or would that be too compact? I thought of writing something like that but filter in python 3 creates an iterator that would have the same issue of walking the dictionary while the dictionary is mutating. changes = list(filter(is_bad, d)) should work.