This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Mark.Shannon, gvanrossum, rhettinger, vstinner
Date 2012-03-05.23:43:12
SpamBayes Score 0.0017101868
Marked as misclassified No
Message-id <1330990993.56.0.282893631163.issue14205@psf.upfronthosting.co.za>
In-reply-to
Content
> I much prefer dict_lookup.patch to nomodify.patch.
> It doesn't increase the memory use of dict. One extra word
> per dict could be a lot of memory for a large application.

nomodify.patch is the correct fix, but I agree that dict_lookup.patch is better (and sufficient) in practive.

> Raising a runtimne seesm sensible as the dict iterators already
> raise a RuntimeError if the size of the dict changes.

Yes, that's how I chose the exception.

>>> d={k: str(k) for k in range(10)}
>>> for k in d:
...  del d[k]
... 
RuntimeError: dictionary changed size during iteration

>>> d={k for k in range(10)}
>>> for k in d:
...  d.remove(k)
... 
RuntimeError: Set changed size during iteration

>>> d=list(range(10))
>>> def keyfunc(x):
...  d.append(1)
...  return x
... 
>>> d.sort(key=keyfunc)
ValueError: list modified during sort
History
Date User Action Args
2012-03-05 23:43:13vstinnersetrecipients: + vstinner, gvanrossum, rhettinger, Mark.Shannon
2012-03-05 23:43:13vstinnersetmessageid: <1330990993.56.0.282893631163.issue14205@psf.upfronthosting.co.za>
2012-03-05 23:43:12vstinnerlinkissue14205 messages
2012-03-05 23:43:12vstinnercreate