On 23 November 2017 at 11:55, Nick Coghlan <ncogh...@gmail.com> wrote:
> On 23 November 2017 at 18:11, Greg Ewing <greg.ew...@canterbury.ac.nz> > wrote: > >> Ivan Levkivskyi wrote: >> >>> "People sometimes want to refactor for-loops containing `yield` into a >>> comprehension but that doesn't work (particularly because of the hidden >>> function scope) - lets make it a SyntaxError" >>> >> >> Personally I'd be fine with removing the implicit function >> scope from comprehensions and allowing yield in them, since >> the semantics of that are clear. >> > > People keep saying this, but seriously, those semantics aren't clear at > all once you actually start trying to implement it. > > If Serhiy will implement his idea (emitting for-loop bytecode inside a try-finally), then I see no problems accepting it as a fix. -- 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