Nick Coghlan <ncogh...@gmail.com> added the comment: Another slight variant to that test case to make sure the inner comprehension actually generates a closure reference in the current implementation:
>>> [[x+y for x in range(2) for y in range(1, i)] for i in range(2, 5)] [[1, 2], [1, 2, 2, 3], [1, 2, 3, 2, 3, 4]] These are the kind of challenges that drove of us towards the current implementation. While the status quo definitely has its downsides, those downsides at least all flow directly from "There's an implicit nested function there that you're not expecting". Yury took all this into account when designing the interaction between `await` and comprehensions (which is why that's in a better state), but for `yield` we inherited the existing behaviour of any other nested function. ---------- _______________________________________ 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