STINNER Victor added the comment:
> The return value is ignored and an empty generator is produced.
It's not ignored: it is passed in the argument of the StopIterator object.
> You can read https://www.python.org/dev/peps/pep-0380 for the entire story.
See also the PEP 479 (Change StopIteratio
Xiang Zhang added the comment:
`return value` is allowed in a generator to support `yield from'. You can read
https://www.python.org/dev/peps/pep-0380 for the entire story.
--
nosy: +xiang.zhang
resolution: -> not a bug
stage: -> resolved
status: open -> closed
__
New submission from Markus Unterwaditzer:
The attached example code raises a SyntaxError in Python 2, but is
syntactically valid in Python 3. The return value is ignored and an empty
generator is produced. I see no reason for this behavioral change.
--
components: Interpreter Core
file