From 1e78f7eb7f04119194e6b041e400ece154326c75 Mon Sep 17 00:00:00 2001 From: John Seong Date: Wed, 31 Dec 2025 15:14:27 -0800 Subject: [PATCH] gh-142965: Fix Concatenate documentation to reflect valid use cases 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 4e9946fd4567cd..3e5c16f5e49910 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 (``...``).