[issue28310] Mixing yield and return with value is allowed

STINNER Victor report at bugs.python.org
Thu Sep 29 06:34:48 EDT 2016


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 StopIteration handling inside generators) and PEP 492 (Coroutines with async and await syntax).

In short, it's a nice Python 3 feature, not a bug ;-)

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28310>
_______________________________________


More information about the Python-bugs-list mailing list