[issue22084] Mutating while iterating

2014-07-26 Thread Nick Coghlan
Nick Coghlan added the comment: Raymond's answer at http://bugs.python.org/issue19332#msg202287 still stands: the checks for mutation while iterating are there primarily to *protect the interpreter itself*, rather than to help detect bugs where the user code misses some items because it mutate

[issue22084] Mutating while iterating

2014-07-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be better discuss such ideas on python-ideas mailing list (http://mail.python.org/mailman/listinfo/python-ideas). Option 3 breaks existing code such as for k, v in d.items(): if pred(k, v): d[k] = newvalue break

[issue22084] Mutating while iterating

2014-07-26 Thread Aaron Brady
New submission from Aaron Brady: Hi, I asked about the inconsistency of the "RuntimeError" being raised when mutating a container while iterating over it here [1], "set and dict iteration" on Aug 16, 2012. [1] http://www.gossamer-threads.com/lists/python/python/1004659 I posted a patch on the