From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 23 Apr 2026 02:57:54 +0000 (+0200) Subject: [3.14] gh-142965: Fix Concatenate documentation to reflect valid use cases (GH-143316... X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0a63bb89717e55bc39e7a574bf29d9cf767c3032;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-142965: Fix Concatenate documentation to reflect valid use cases (GH-143316) (#148899) 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 75ff1afcb6a1bb2b3d54899e9b222a61798fa491) Co-authored-by: John Seong <39040639+sandole@users.noreply.github.com> --- diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index a2625ab2a371..40f8c130d801 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -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 `. + is valid when used in :ref:`Callable ` 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 (``...``).