Skip to content

Commit 75ff1af

Browse files
authored
gh-142965: Fix Concatenate documentation to reflect valid use cases (#143316)
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.
1 parent bd7352d commit 75ff1af

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Doc/library/typing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,8 @@ These can be used as types in annotations. They all support subscription using
11741174
or transforms parameters of another
11751175
callable. Usage is in the form
11761176
``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. ``Concatenate``
1177-
is currently only valid when used as the first argument to a :ref:`Callable <annotating-callables>`.
1177+
is valid when used in :ref:`Callable <annotating-callables>` type hints
1178+
and when instantiating user-defined generic classes with :class:`ParamSpec` parameters.
11781179
The last parameter to ``Concatenate`` must be a :class:`ParamSpec` or
11791180
ellipsis (``...``).
11801181

0 commit comments

Comments
 (0)