mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[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:
parent
d36aa244c8
commit
9a7c4a5f39
2 changed files with 91 additions and 65 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue