8000 typing docs: Add example for async functions (GH-20386) · python/cpython@e7de543 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7de543

Browse files
typing docs: Add example for async functions (GH-20386)
Fixes python/typingGH-424 (cherry picked from commit 9588f88) Co-authored-by: Sam Bull <aa6bs0@sambull.org>
1 parent a48d31f commit e7de543

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/typing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ For example::
211211
on_error: Callable[[int, Exception], None]) -> None:
212212
# Body
213213

214+
async def on_update(value: str) -> None:
215+
# Body
216+
callback: Callable[[str], Awaitable[None]] = on_update
217+
214218
It is possible to declare the return type of a callable without specifying
215219
the call signature by substituting a literal ellipsis
216220
for the list of arguments in the type hint: ``Callable[..., ReturnType]``.

0 commit comments

Comments
 (0)
0