10000 typing docs: Add example for async functions (GH-20386) · hello-adam/cpython@c69fa62 · GitHub
[go: up one dir, main page]

Skip to content

Commit c69fa62

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

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
@@ -194,6 +194,10 @@ For example::
194194
on_error: Callable[[int, Exception], None]) -> None:
195195
# Body
196196

197+
async def on_update(value: str) -> None:
198+
# Body
199+
callback: Callable[[str], Awaitable[None]] = on_update
200+
197201
It is possible to declare the return type of a callable without specifying
198202
the call signature by substituting a literal ellipsis
199203
for the list of arguments in the type hint: ``Callable[..., ReturnType]``.

0 commit comments

Comments
 (0)
0