[Python-Dev] Tricky way of of creating a generator via a comprehension expression

Antoine Pitrou solipsis at pitrou.net
Thu Nov 23 06:53:26 EST 2017

On Thu, 23 Nov 2017 09:50:27 +0000
Paul Moore <p.f.moore at gmail.com> wrote:
> On 23 November 2017 at 09:14, Steve Holden <steve at holdenweb.com> wrote:
> > I would urge developers, in their improvements to the language to support
> > asynchronous programming, to bear in mind that this is (currently) a
> > minority use case. Why the rush to set complex semantics in stone?  
> +1
> Also, given that languages like C# have similar async/await
> functionality, I'd be interested to know how they address questions
> like this. If they have a parallel, we should probably follow it. If
> they don't that would be further indication that no-one has much
> experience of the "best answers" yet, and caution is indicated.

This discussion isn't about async/wait or asynchronous programming.

It's about "yield" (which used to be the standard for asynchronous
programming before async/await, but isn't anymore).  The fact that
"await" is now the standard still weakens the case for "yield" inside
comprehensions and generator expressions.

As someone who does asynchronous programming daily using "yield"
(because of compatibility requirements with Python 2), I don't think
I've even tried to use "yield" in a comprehension or generator
expression.  The use case doesn't seem to exist.



More information about the Python-Dev mailing list