[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration
Greg Ewing 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 <https://bugs.python.org/issue35756> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration
Greg Ewing added the comment: There is no bug here; the current implementation is working as intended. The word "yields" in the quoted section of the PEP indeed refers to the "yield" keyword and nothing else. Possibly that could be clarified, but I believe it's already clear enough when read in the context of the rest of the PEP. -- nosy: +greg.ewing ___ Python tracker <https://bugs.python.org/issue35756> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com