mirror of
https://github.com/python/cpython.git
synced 2026-06-25 02:20:56 +00:00
[3.13] gh-142965: Fix Concatenate documentation to reflect valid use cases (GH-143316) (#148900)
The documentation previously stated that Concatenate is only valid
when used as the first argument to Callable, but according to PEP 612,
it can also be used when instantiating user-defined generic classes
with ParamSpec parameters.
(cherry picked from commit 75ff1afcb6)
Co-authored-by: John Seong <39040639+sandole@users.noreply.github.com>
This commit is contained in:
parent
f540bc9d4a
commit
7dd784e701
1 changed files with 2 additions and 1 deletions
|
|
@ -1166,7 +1166,8 @@ These can be used as types in annotations. They all support subscription using
|
|||
or transforms parameters of another
|
||||
callable. Usage is in the form
|
||||
``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. ``Concatenate``
|
||||
is currently only valid when used as the first argument to a :ref:`Callable <annotating-callables>`.
|
||||
is valid when used in :ref:`Callable <annotating-callables>` type hints
|
||||
and when instantiating user-defined generic classes with :class:`ParamSpec` parameters.
|
||||
The last parameter to ``Concatenate`` must be a :class:`ParamSpec` or
|
||||
ellipsis (``...``).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue