Ivan Levkivskyi added the comment: > How about fixing CPython to raise SyntaxWarning or even SyntaxError?
I think it is better to just fix the issue, i.e. make comprehensions be equivalent to for-loops even if they contain `yield`. (In particular this will lead to [(yield i) for i in range(5)] be SyntaxError outside function). The example of `await` shows that it is possible without leaking the loop variable into enclosing scope. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10544> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com