-
Notifications
You must be signed in to change notification settings - Fork 258
Can typing.TypeVar
et al. be deprecated?
#1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not only is |
My point is that there is no mention of any sort of deprecation in the docs. Contrast this with e.g.
Why wasn't the same done for |
I guess I can think of one reason: Just as from inspect import signature
def ident[T](x: T) -> T:
return x
x_annot = signature(ident).parameters["x"].annotation
print(type(x_annot)) # <class 'typing.TypeVar'> And there is one hint in the docs that PEP 695 syntax should be preferred, just not in the usual "deprecation notice" place but at the start of
So you're right 👍 Issue can remain closed. |
Uh oh!
There was an error while loading. Please reload this page.
PEP 695 (Type Parameter Syntax) says:
If that is the only reason they are kept around in
typing
, wouldn't it make sense to mark them as deprecated?Or are there situations in which they still have advantages over PEP 695's dedicated syntax for type parameters?
The current Python docs just point out that a new syntax for type parameters exists, but don't say anything about deprecation:
Related issues
The text was updated successfully, but these errors were encountered: