Open srittau opened 11 months ago
I think we can never fully switch to the new syntax, because sometimes we need to choose a variance that type checkers disagree with, as in #8781.
I think we can never fully switch to the new syntax, because sometimes we need to choose a variance that type checkers disagree with, as in #8781.
That will be quite rare, though; we can aspire to use the new syntax nearly all of the time
We also occasionally have public type vars, but I agree with Alex that we should at least aspire to use the new syntax. (In five years or so.)
This issue is supposed to track when we can start to use the improved generics syntax introduced in Python 3.12 (PEP 695 in typeshed. Support is needed in released versions of:
As this is a syntax change, it's unlikely that we can add support before mypy drops support for running under Python 3.11 and below.
Example from the PEP: