Message279968
Hmm, the resolution could be simple. But how about
>>> d = dict.fromkeys(range(100))
>>> for k in range(98):
... del d[k]
...
>>> it = iter(d)
>>> next(it)
98
>>> d.clear()
>>> d[0] = 1
>>> d[1] = 2
>>> next(it)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
Actually we haven't exhaust the dict yet. Is it reasonable for me to expect the second next returning 0? I actually mean is it reasonable for me to expect len(dict) elements returned before StopIteration raised even if the dict is changed? |
|
Date |
User |
Action |
Args |
2016-11-03 07:26:58 | xiang.zhang | set | recipients:
+ xiang.zhang, vstinner, methane, serhiy.storchaka |
2016-11-03 07:26:58 | xiang.zhang | set | messageid: <1478158018.07.0.180192921791.issue28580@psf.upfronthosting.co.za> |
2016-11-03 07:26:58 | xiang.zhang | link | issue28580 messages |
2016-11-03 07:26:57 | xiang.zhang | create | |
|