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

Skip to content

Commit 9588f88

Browse files
typing docs: Add example for async functions (#20386)
Fixes python/typing#424
1 parent 1066ecb commit 9588f88

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
@@ -221,6 +221,10 @@ For example::
221221
on_error: Callable[[int, Exception], None]) -> None:
222222
# Body
223223

224+
async def on_update(value: str) -> None:
225+
# Body
226+
callback: Callable[[str], Awaitable[None]] = on_update
227+
224228
It is possible to declare the return type of a callable without specifying
225229
the call signature by substituting a literal ellipsis
226230
for the list of arguments in the type hint: ``Callable[..., ReturnType]``.

0 commit comments

Comments
 (0)
0