Skip to content

Commit

Permalink
typing docs: Add example for async functions (GH-20386)
Browse files Browse the repository at this point in the history
Fixes python/typingGH-424
(cherry picked from commit 9588f88)

Co-authored-by: Sam Bull <[email protected]>
  • Loading branch information
Dreamsorcerer authored and miss-islington committed May 1, 2022
1 parent cef3a99 commit 508f13a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ For example::
on_error: Callable[[int, Exception], None]) -> None:
# 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
the call signature by substituting a literal ellipsis
for the list of arguments in the type hint: ``Callable[..., ReturnType]``.
Expand Down

0 comments on commit 508f13a

Please sign in to comment.