From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 1 May 2022 04:59:26 +0000 (-0700) Subject: typing docs: Add example for async functions (GH-20386) X-Git-Tag: v3.9.13~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fcbff77b26c44b8ee58c2ef2c3b25b3ffe7c20e9;p=thirdparty%2FPython%2Fcpython.git typing docs: Add example for async functions (GH-20386) Fixes python/typingGH-424 (cherry picked from commit 9588f880a286a8cc5597188f6ab44108c8f18761) Co-authored-by: Sam Bull --- diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 202f5b5e8fec..c0af2ed7c429 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -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]``.