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:27:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549891669.28.0.260534836361.issue35966@roundup.psfhosted.org>
In-reply-to
Content
Python 3.6.7 |Anaconda custom (64-bit)| (default, Oct 28 2018, 19:44:12) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def generate_loop():
...     for i in range(10):
...         print(i)
...         # should raise StopIteration when i > 5
...         k = next(j for j in range(5) if j == i)
...         print(k)
...         yield k
...
>>>
>>> def generate():
...     # should raise StopIteration
...     k = next(j for j in range(5) if j == 6)
...     yield k
...
>>>
>>> print(list(generate_loop()))
0
0
1
1
2
2
3
3
4
4
5
[0, 1, 2, 3, 4]
>>>
>>> print(list(generate()))
[]
>>>
>>> k = next(j for j in range(5) if j == 6)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
>>>
History
Date User Action Args
2019-02-11 13:27:51sheiunsetrecipients: + sheiun
2019-02-11 13:27:49sheiunsetmessageid: <1549891669.28.0.260534836361.issue35966@roundup.psfhosted.org>
2019-02-11 13:27:49sheiunlinkissue35966 messages
2019-02-11 13:27:49sheiuncreate