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 sheiun
Recipients sheiun
Date 2019-02-11.13:31:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549891909.31.0.0607349100074.issue35966@roundup.psfhosted.org>
In-reply-to
Content
But it still can catch by using try/except

>>> def generate_loop_stopiteration():
...     for i in range(10):
...         print(i)
...         # should raise StopIteration when i > 5
...         try:
...             k = next(j for j in range(5) if j == i)
...         except StopIteration:
...             print('catch')
...         print(k)
...         yield k
...
>>> print(list(generate_loop_stopiteration()))
0
0
1
1
2
2
3
3
4
4
5
catch
4
6
catch
4
7
catch
4
8
catch
4
9
catch
4
[0, 1, 2, 3, 4, 4, 4, 4, 4, 4]
>>>
History
Date User Action Args
2019-02-11 13:31:50sheiunsetrecipients: + sheiun
2019-02-11 13:31:49sheiunsetmessageid: <1549891909.31.0.0607349100074.issue35966@roundup.psfhosted.org>
2019-02-11 13:31:49sheiunlinkissue35966 messages
2019-02-11 13:31:49sheiuncreate