Message154991
| 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:13 | vstinner | set | recipients:
+ vstinner, gvanrossum, rhettinger, Mark.Shannon |
| 2012年03月05日 23:43:13 | vstinner | set | messageid: <1330990993.56.0.282893631163.issue14205@psf.upfronthosting.co.za> |
| 2012年03月05日 23:43:12 | vstinner | link | issue14205 messages |
| 2012年03月05日 23:43:12 | vstinner | create |
|