Add example for async functions.
Fixes: https://github.com/python/typing/issues/424
This commit is contained in:
parent
e682b26a6b
commit
48d7639f8f
|
@ -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]``.
|
||||||
|
|
Loading…
Reference in New Issue