-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Adds support for NamedTuple
subtyping
#11162
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
Conversation
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.
I agree with Jelle that this is a bit questionable, since NamedTuple is not a real type, but I guess it could be useful in some cases. We can mark this as an experimental feature and see what users think about it.
Can you add a test case to pythoneval.test
that uses the full stdlib stubs? Try accessing various attributes that might be useful in the test case. The new behavior depends on how NamedTuple
is defined in typeshed.
Also, this would have to be documented since this is a non-standard extension.
@JukkaL I've added both |
I need this change in my new semantic analyzer for namedtuples #11047 😞 |
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.
Sorry for the late review! A few more minor comments.
Done! Docs and tests are improved 👍 |
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.
Thanks, looks good now!
@JukkaL thank you 🎉 🎉 |
Closes #11160