On 23 November 2017 at 09:17, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> Ivan Levkivskyi wrote: > >> "People sometimes want to refactor for-loops containing `yield` into a >> comprehension >> > > By the way, do we have any real-life examples of people wanting to > do this? It might help us decide what the semantics should be. > > Yes, there are two SO questions in two first posts here, also there are some b.p.o. issues. It looks like in all case people expect: def f(): return [(yield i) for i in range(3)] to be roughly equivalent to def f(): res = [] for i in range(3): r = yield i res.append(r) return res See Serhiy's original post for more detailed proposed semantic equivalence. -- Ivan
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com