[Python-ideas] async/await in Python

Andrew Svetlov andrew.svetlov at gmail.com
Sat Apr 18 17:17:47 CEST 2015


Greg, thank you for raising PEP 3152.

When I discussed PEP for async/await with Yuri and Guido offline at
PyCon I've mentioned Cofunctions PEP.
Sure, Yuri have remembered it on working on your own PEP.

>From my perspective async/await syntax is better for teaching newcomers.
cofor and cowith looks ugly and cryptic, sorry.

There is simple mnemonic: rule async is for asynchronous.
co- for coroutine forces you to describe what is coroutine first.

Also cofunc, codef, cofor and cowith requires more keywords in python
syntax, which is not our desire I guess.

Anyway, thank for your PEP -- it gives an inspiration.
Perhaps Yuri should mention it in own PEP 492 at least.


On Fri, Apr 17, 2015 at 8:21 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Yury Selivanov wrote:
>>
>>
>> Here's my proposal to add async/await in Python.
>
>
> You've essentially reinvented PEP 3152 - Cofunctions.
>
> https://www.python.org/dev/peps/pep-3152/
>
> Here's a summary of the relationships between them:
>
> PEP 3152                  Nearest equivalent in Yury's PEP
> --------                  --------------------------------
>
> codef f(args):            async def f(args):
>
> cocall f(args)            await f(args)
>
> __cocall__                __await__
>
> costart()                 async_def()
>
> There is currently no equivalent of "async for" and
> "async with" in PEP 3152, but they could easily be added.
> I would probably spell them "cofor" and "cowith".
>
> As the author of PEP 3152 I'm obviously biased, but I
> think my spellings are more elegant and less disruptive
> to reading of the code.
>
> PEP 3152 is currently marked as deferred. Maybe it's
> time to revive it? If Yury's pep is to be considered,
> we ought to discuss the relative merits of the two.
>
> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Thanks,
Andrew Svetlov


More information about the Python-ideas mailing list