Problem with OrderedDict - progress report

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Jun 1 03:54:14 EDT 2018


Chris Angelico wrote:
> It is an error to mutate the dictionary *and then continue to iterate over it*.

But if you're processing the last key, and you add one so
that it's no longer the last key, what should happen?

My feeling is that this should be an error, because it's
not clear whether iteration should stop at that point
or not.

-- 
Greg



More information about the Python-list mailing list