From e173bd0e0ff5179604b48cd68cb242751a55fe64 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 2 Oct 2023 21:42:15 -0700 Subject: [PATCH] PEP 695: __type_params__ attribute is writable (#3457) 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 182a3eb52..837f8c1b6 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.