Message154991
> 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 |
|
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 | |
|