Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcbff77

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 <[email protected]>
1 parent cef3a99 commit fcbff77

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/typing.rst

+4
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)