On Tue, 13 Jun 2023 at 09:33, Greg Ewing <gcew...@snap.net.nz> 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 my mind, the fact that coroutines use the same underlying
> mechanism as generators is an implementation detail. It's
> only like that for historical reasons, and it could change in
> the future.
>

I think they currently use what's basically a copy of the generator
implementation. It makes sense to make resumable functions that way.

(Fun fact: Pike looked at what Python was doing, and came up with a
concept of "continue functions" which work broadly the same way that
generators do, but with a declaration - kinda on par with writing
"continue def gen():" in Python. Yes, it reuses the "continue"
keyword.)

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/KN4SBHIQ4UHIJHANKE6FPX53YHVRUAOA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to