You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What type bound parameter of typing.TypeVar accepts should be explained more clearly #145524
For T and A, what type is accepted is clearly explained in the example of typing.TypeVar while for S isn't explained clearly even though str itself is also accepted as shown below:
T=TypeVar('T') # Can be anythingS=TypeVar('S', bound=str) # Can be any subtype of str <- HereA=TypeVar('A', str, bytes) # Must be exactly str or bytes
So, S should be explained more clearly as shown below:
S=TypeVar('S', bound=str) # Can be str or any subtype of str
Activity
picnixz commentedon Mar 5, 2026
T is a subtype of itself so I don't think it should be changed.
picnixz commentedon Mar 5, 2026
Ok, nvm, Alex was ok with the PR.
gh-145524: Update comment for TypeVar S in typing.rst (#145525)
pythongh-145524: Update comment for TypeVar S in typing.rst (pythonGH…
[3.14] gh-145524: Update comment for TypeVar S in typing.rst (GH-145525…