-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shouldn't typing also have Coroutine? #251
Comments
No, I suspect it was left out by mistake. |
OK, I'll just add it then.
|
it would be neat if we could specify the parameters to the coroutine as well...something like: async def dummy(dummy_param: int) -> Awaitable[None]:
return
async needs_typing(co_method: Coroutine[int]):
await co_method(1)
await needs_typing(dummy) I just realized a super neat thing would be also being able to specify the return type of async needs_typing(co_method: Coroutine[[int], None]):
await co_method(1)
|
@gvanrossum class Coroutine(Awaitable[ret_type_co], Generic[yield_type_co, send_type_contra, ret_type_co]):
... |
I'm fine with you doing this, but I had thought that Coroutine would have
only one parameter (the return type). I guess this means we'll need to look
at some example code to see how it would be used.
|
In principle a normal coroutine defined with |
@gvanrossum Yet another option would be to make |
Oh, no! I think after all it should indeed mimic Generator. |
PEP 492 introduces a few new ABCs: Awaitable, Coroutine, AsyncIterable, AsyncIterator. PEP 484 lists three of these: Awaitable, AsyncIterable, AsyncIterator. What happened to Coroutine? A Coroutine is an Awaitable that also supports send(), throw() and close().
It seems a simple oversight. Let's fix it before 3.5.3 comes out.
@1st1 do you remember any of this? Do you recall a reason to leave out Coroutine?
The text was updated successfully, but these errors were encountered: