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

Fixes __init__ of typing.NamedTuple #6080

Merged
merged 2 commits into from
Sep 29, 2021
Merged

Fixes __init__ of typing.NamedTuple #6080

merged 2 commits into from
Sep 29, 2021

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Sep 26, 2021

Two things to discuss:

  1. (Iterable[Tuple[str, Any]] and kwargs: Any) or (Iterable[Tuple[str, type]] and kwargs: type)
  2. Do we need fields: None = ... in the second overload?

Closes #6079

@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member

I think @srittau accidentally edited your comment instead of responding to your questions. I restored your original comment (approximately, couldn't find the raw markdown). Here are my thoughts:

(Iterable[Tuple[str, Any]] and kwargs: Any) or (Iterable[Tuple[str, type]] and kwargs: type)

I'd say the former. Not all acceptable types are actually types.

Do we need fields: None = ... in the second overload?

Yes, because fields=None is legal at runtime.

@sobolevn
Copy link
Member Author

@JelleZijlstra done! I agree with fields=None and type after writting so many tests in python/mypy#11206 😆

@github-actions
Copy link
Contributor

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

@hauntsaninja hauntsaninja merged commit 4ac969a into python:master Sep 29, 2021
@sobolevn
Copy link
Member Author

Thanks everyone! 🎉

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.

Fix __init__ type of typing.NamedTuple
3 participants