[Python-ideas] Re: yield functionality to match that of await

2023-06-12 Thread Chris Angelico
On Tue, 13 Jun 2023 at 14:54, Greg Ewing wrote: > > On 13/06/23 11:38 am, Chris Angelico wrote: > > (Fun fact: Pike looked at what Python was doing, and came up with a > > concept of "continue functions" > > And I gather that the "async" and "await" keywords came > from C#. Languages are always

[Python-ideas] Re: yield functionality to match that of await

2023-06-12 Thread Greg Ewing
On 13/06/23 11:38 am, Chris Angelico wrote: I think they currently use what's basically a copy of the generator implementation. It makes sense to make resumable functions that way. In many ways it does, although things get a bit messy when it comes to async generators. If I were designing somet

[Python-ideas] Re: yield functionality to match that of await

2023-06-12 Thread Chris Angelico
On Tue, 13 Jun 2023 at 09:33, Greg Ewing wrote: > > On 13/06/23 9:29 am, Dom Grigonis wrote: > > Also, could anyone point me in the direction, where it is explained why new > > await/async syntax was introduced instead of making use of already existing > > yield coroutine functionality? > > To m

[Python-ideas] Re: yield functionality to match that of await

2023-06-12 Thread Greg Ewing
On 13/06/23 9:29 am, Dom Grigonis wrote: Also, could anyone point me in the direction, where it is explained why new await/async syntax was introduced instead of making use of already existing yield coroutine functionality? To my mind, the fact that coroutines use the same underlying mechanis

[Python-ideas] Re: yield functionality to match that of await

2023-06-12 Thread Chris Angelico
On Tue, 13 Jun 2023 at 07:33, Dom Grigonis wrote: > > I was wandering if there are any issues in making `yield` usage to be the > same as that of `await` > > Most importantly: > l.append(yield Object()) You should be able to use that, since yield *is* an expression. The only oddity is, you have