From 48d7639f8f76010cc4e38f6ec8bbeae9d04e9cfa Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 25 May 2020 15:55:35 +0100 Subject: [PATCH] Add example for async functions. Fixes: https://github.com/python/typing/issues/424 --- Doc/library/typing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index fa13c07c44ea3a..d9605348536316 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -165,6 +165,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]``.