Add example for async functions.

Fixes: https://github.com/python/typing/issues/424
This commit is contained in:
Sam Bull 2020-05-25 15:55:35 +01:00 committed by GitHub
parent e682b26a6b
commit 48d7639f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -165,6 +165,10 @@ For example::
on_error: Callable[[int, Exception], None]) -> None: on_error: Callable[[int, Exception], None]) -> None:
# Body # Body
async def on_update(value: str) -> None:
# Body
callback: Callable[[str], Awaitable[None]] = on_update
It is possible to declare the return type of a callable without specifying It is possible to declare the return type of a callable without specifying
the call signature by substituting a literal ellipsis the call signature by substituting a literal ellipsis
for the list of arguments in the type hint: ``Callable[..., ReturnType]``. for the list of arguments in the type hint: ``Callable[..., ReturnType]``.