From 4e4357fd2f64e5bf548e4a4a59cb8b29d95378b8 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sun, 1 Oct 2023 15:43:32 -0700 Subject: [PATCH] PEP 695: __type_params__ attribute is writable Fixes python/cpython#104600. We realized that the attribute should be writable on functions and classes for the benefit of wrappers such as @functools.wraps. --- peps/pep-0695.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peps/pep-0695.rst b/peps/pep-0695.rst index 182a3eb523f..837f8c1b674 100644 --- a/peps/pep-0695.rst +++ b/peps/pep-0695.rst @@ -602,7 +602,7 @@ is a generator or coroutine. Accessing Type Parameters at Runtime ------------------------------------ -A new read-only attribute called ``__type_params__`` is available on generic classes, +A new attribute called ``__type_params__`` is available on generic classes, functions, and type aliases. This attribute is a tuple of the type parameters that parameterize the class, function, or alias. The tuple contains ``TypeVar``, ``ParamSpec``, and ``TypeVarTuple`` instances.