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

Add typing_extensions.NamedTuple #8295

Merged
merged 7 commits into from
Jul 14, 2022
Merged

Add typing_extensions.NamedTuple #8295

merged 7 commits into from
Jul 14, 2022

Conversation

AlexWaygood
Copy link
Member

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
Copy link
Member

Would anything break if we unconditionally did from typing import NamedTuple as NamedTuple? We already do that for overload too.

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Jul 14, 2022

Would anything break if we unconditionally did from typing import NamedTuple as NamedTuple? We already do that for overload too.

My thinking was that type checkers might want to distinguish typing_extensions.NamedTuple from typing.NamedTuple, so that they can emit an error if a user tries to create a generic typing.NamedTuple on <3.11, since that will fail at runtime. I.e., it would be a similar argument to the argument made in #7130 for declaring typing_extensions.Protocol as a distinct symbol to typing.Protocol.

This is purely hypothetical, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mypy and Pyright complain when importing new NamedTuple
2 participants