Skip to content
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

Support infer_variance= parameter for TypeVar (PEP 695) #17811

Open
JukkaL opened this issue Sep 23, 2024 · 2 comments
Open

Support infer_variance= parameter for TypeVar (PEP 695) #17811

JukkaL opened this issue Sep 23, 2024 · 2 comments
Labels
feature topic-pep-695 Issues related to PEP 695 syntax

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Sep 23, 2024

Feature

See this section of PEP for details.

Pitch

This is probably the most significant omission from full PEP 695 support (though this mostly impacts users of older Python versions).

@jonaslb
Copy link

jonaslb commented Oct 30, 2024

this mostly impacts users of older Python versions

Is there a reason that this is expected to be mostly relevant for users of older Python versions? It seems to me to be a very useful addition when implemented. Variance almost always needs to be specified according to the inference rules anyway (and you might need both _co and _contra variants of a type variable instead of only one).

@JelleZijlstra
Copy link
Member

@jonaslb because in Python 3.12 and newer, you can use the native generic syntax, which always implicitly infers variance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-pep-695 Issues related to PEP 695 syntax
Projects
None yet
Development

No branches or pull requests

3 participants