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 xiang.zhang
Recipients methane, serhiy.storchaka, vstinner, xiang.zhang
Date 2016-11-03.07:26:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1478158018.07.0.180192921791.issue28580@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-11-03 07:26:58xiang.zhangsetrecipients: + xiang.zhang, vstinner, methane, serhiy.storchaka
2016-11-03 07:26:58xiang.zhangsetmessageid: <1478158018.07.0.180192921791.issue28580@psf.upfronthosting.co.za>
2016-11-03 07:26:58xiang.zhanglinkissue28580 messages
2016-11-03 07:26:57xiang.zhangcreate