From 9588f880a286a8cc5597188f6ab44108c8f18761 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 1 May 2022 05:40:27 +0100 Subject: [PATCH] typing docs: Add example for async functions (#20386) Fixes python/typing#424 --- Doc/library/typing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 426cbf12b8c..868ea1b81be 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -221,6 +221,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]``.