From 6a26b0686b73640805c3cb0898525d1b1e719614 Mon Sep 17 00:00:00 2001 From: "Kai (Kazuya Ito)" Date: Thu, 5 Mar 2026 13:06:12 +0900 Subject: [PATCH 1/2] Update comment for TypeVar S in typing.rst Clarified the comment for type variable S to specify it can be str or any subtype of str. --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 09e9103e1b80d04..c707d53d14bf19d 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1809,7 +1809,7 @@ without the dedicated syntax, as documented below. However, if desired, reusable type variables can also be constructed manually, like so:: T = TypeVar('T') # Can be anything - S = TypeVar('S', bound=str) # Can be any subtype of str + S = TypeVar('S', bound=str) # Can be str or any subtype of str A = TypeVar('A', str, bytes) # Must be exactly str or bytes Type variables exist primarily for the benefit of static type From 8ec6c9429de8a32ca2f9cc004d701aa2b9c114f0 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 3 Jun 2026 05:44:57 -0700 Subject: [PATCH 2/2] Update Doc/library/typing.rst --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index c707d53d14bf19d..a7b42a001bee33c 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1809,7 +1809,7 @@ without the dedicated syntax, as documented below. However, if desired, reusable type variables can also be constructed manually, like so:: T = TypeVar('T') # Can be anything - S = TypeVar('S', bound=str) # Can be str or any subtype of str + S = TypeVar('S', bound=str) # Can be str or any subtype of str (including str itself) A = TypeVar('A', str, bytes) # Must be exactly str or bytes Type variables exist primarily for the benefit of static type