-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Additional validation for TypeVar defaults (PEP 696) #15442
Additional validation for TypeVar defaults (PEP 696) #15442
Conversation
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
I've been wondering: why don't we use |
Until recently it wasn't an option, because we supported Python 3.6, and dataclasses were introduced in Python 3.7. Slotted classes are also more performant, though, and you can't do slotted classes with dataclasses on <3.10. (Performance matters quite a lot for mypy!) |
You can, you just have to write out the |
Good point, I forgot about that. |
Might also be that "normal" classes are already quite optimized with mypyc, not sure about that though. Would certainly require some more analysis. |
Could someone add the |
Done! |
Check that
default
type is a subtype ofbound
or one of the constraint types.Add
default
to nodes__match_args__
. Missed that initially.Ref: #14851