diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-05-01 04:55:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-01 04:55:58 (GMT) |
commit | e7de54321952ebb58cc414f2160c9ad4f6510af2 (patch) | |
tree | d27cab2bf0dac00645e90fa820d533b88a745df8 /Doc/library/typing.rst | |
parent | a48d31f204642c8b38e55dd78c4839bb7ae5dce9 (diff) | |
download | cpython-e7de54321952ebb58cc414f2160c9ad4f6510af2.zip cpython-e7de54321952ebb58cc414f2160c9ad4f6510af2.tar.gz cpython-e7de54321952ebb58cc414f2160c9ad4f6510af2.tar.bz2 |
typing docs: Add example for async functions (GH-20386)
Fixes python/typingGH-424
(cherry picked from commit 9588f880a286a8cc5597188f6ab44108c8f18761)
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
Diffstat (limited to 'Doc/library/typing.rst')
-rw-r--r-- | Doc/library/typing.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 36d637f..6a160af 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -211,6 +211,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]``. |