]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142965: Fix Concatenate documentation to reflect valid use cases (#143316)
authorJohn Seong <39040639+sandole@users.noreply.github.com>
Thu, 23 Apr 2026 02:46:04 +0000 (10:46 +0800)
committerGitHub <noreply@github.com>
Thu, 23 Apr 2026 02:46:04 +0000 (19:46 -0700)
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.

Doc/library/typing.rst

index 9bc0a3caeee8bf8e751eba878ea8eb91e17b202a..04acf2c16d15d2ebaed270469bc37e5fa7170e1e 100644 (file)
@@ -1174,7 +1174,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 (``...``).