[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration

Greg Ewing report at bugs.python.org
Fri Jan 18 17:38:27 EST 2019


Greg Ewing <greg.ewing at canterbury.ac.nz> added the comment:

bryan.koch wrote:
> It would be awesome if invoking a generator above would throw a
> SyntaxError iff it contained a return and it wasn't invoked through `yield
> from`.

Why do you care about that so much? There's nothing to stop you
from ignoring the return value of an ordinary function. Why should
generator functions be different?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35756>
_______________________________________


More information about the Python-bugs-list mailing list