[Python-ideas] async/await in Python

Yury Selivanov yselivanov.ml at gmail.com
Tue Apr 21 18:59:29 CEST 2015


On 2015-04-21 12:20 PM, Yury Selivanov wrote:
> BTW, there is one more thing about requiring a keyword
> to make a coroutine call.  If we decide to implement
> coroutine-generators one day, a simple call to
> coroutine-generator should return a coroutine-generator
> object:
>
> async def foo():
>    async yield 1
>
> foo() # <- coroutine-generator object
>
> In the other hand, if you don't have an 'async yield'
> expression, then
>
> foo()
>
> would raise an error.  I'm not sure I like this duality. 

Of course we can have __cocall__ (and no __call__) for
regular coroutines and __call__ (no __cocall__) for
coroutine-generators, but this also looks suspicious.

Yury


More information about the Python-ideas mailing list