On Sat, 25 Nov 2017 17:10:12 +1000 Nick Coghlan <ncogh...@gmail.com> wrote: > On 25 November 2017 at 16:18, Nathaniel Smith <n...@pobox.com> wrote: > > On Fri, Nov 24, 2017 at 9:39 PM, Nick Coghlan <ncogh...@gmail.com> wrote: > >> On 25 November 2017 at 15:27, Nathaniel Smith <n...@pobox.com> wrote: > >>> On Fri, Nov 24, 2017 at 9:04 PM, Nick Coghlan <ncogh...@gmail.com> wrote: > >>> > >>>> def example(): > >>>> comp1 = yield from [(yield x) for x in ('1st', '2nd')] > >>>> comp2 = yield from [(yield x) for x in ('3rd', '4th')] > >>>> return comp1, comp2 > >>> > >>> Isn't this a really confusing way of writing > >>> > >>> def example(): > >>> return [(yield '1st'), (yield '2nd')], [(yield '3rd'), (yield '4th')] > >>> > >> > >> A real use case > > > > Do you have a real use case? This seems incredibly niche... > > That's not how backwards compatibility works - we were suggesting > getting rid of this syntax, because there was no current way to make > it do anything sensible. > > It turns out there is a way to make it behave reasonably - you just > need to stick "yield from" in front of it, and it goes back to being > equivalent to the corresponding for loop (the same as the synchronous > version).
I don't know if it behaves reasonably, but it's entirely unreadable to me. I think there's a case for discouraging unreadable constructs. Regards Antoine. _______________________________________________ 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