[3.12] typing: Improve documentation of generic classes and aliases (GH-105369) (#105453)

typing: Improve documentation of generic classes and aliases (GH-105369)
(cherry picked from commit d63a7c3694)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-06-07 08:04:14 -07:00 committed by GitHub
parent d36aa244c8
commit 9a7c4a5f39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 65 deletions

View file

@ -2549,11 +2549,13 @@ Callable = _CallableType(collections.abc.Callable, 2)
Callable.__doc__ = \
"""Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function of (int) -> str.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec or ellipsis.
The return type must be a single type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.