-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Annotate TypedDict as _SpecialForm rather than object. #12985
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we take this approach, should we be removing __getitem__
from _SpecialForm
?
Hmm, I didn't look closely enough at It also looks like there are some weird mypy primer errors about a type mismatch between Let me think a bit more about this PR. Tbh I might just give up on it, since the motivation for it wasn't particularly strong in the first place. It just looked odd to me to have |
This comment has been minimized.
This comment has been minimized.
Ok, I've had a chance to think about and play around with this a bit more:
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
For consistency, I think it would be slightly better to use
_SpecialForm
rather than object here. The comment suggests thatobject
was used becauseTypedDict
is non-subscriptable, butNoReturn
is also non-subscriptable and is annotated as_SpecialForm
.