Nick Coghlan <ncogh...@gmail.com> added the comment: Given the direction of the python-dev thread, should we split this question into two issues?
Issue 1: a yield expression inside a comprehension changes the type of the expression result (returning a generator-iterator instead of the expected container type) Issue 2: a yield expression inside a generator expression interacts weirdly with the genexp's implicit yield expression I ask, as it seems to me that issue 1 can be addressed by wrapping the affected cases in an implicit 'yield from' expression, which will both fix the return type of the expression and turn the outer function into a generator (if it isn't one already). (I'm going to put together a proof-of-concept for that idea this weekend) By contrast, the interaction between generator expressions and explicit yield expressions seems intrinsically confusing, so I'm not sure we can do any better than declaring it a syntax error to try to combine them. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue10544> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com