-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-116241: Add support of multiple inheritance with typing.NamedTuple #31781
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
base: main
Are you sure you want to change the base?
gh-116241: Add support of multiple inheritance with typing.NamedTuple #31781
Conversation
637bdd3
to
64f0c5f
Compare
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 think this goes too far because it's not realistic to expect type checkers to support arbitrary base classes on NamedTuple. Also, there haven't been any user requests that I can see for multiple inheritance with anything other than Generic. So I'd prefer to merge the other PR that allows multiple inheritance with Generic only.
I also think it makes sense to only allow multiple inheritance with |
So, let's just close this? |
5077333
to
d4bc711
Compare
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.
people really need arbitrary multiple inheritance for whatever reason
Thanks for reopening! This looks like the case now indeed
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.
Looks great! I ended up doing nearly exactly the same thing in some code of my own to get around this limitation.
Misc/NEWS.d/next/Library/2022-04-28-18-45-58.gh-issue-116241.hu9kRk.rst
Outdated
Show resolved
Hide resolved
Thank you @AlexWaygood and @gvanrossum. Updated to 3.14 and applied the suggestions. |
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.
Given that we've had multiple requests for this, I'm okay with landing it. But please get sign-offs from @gvanrossum and @JelleZijlstra before merging.
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.
Let's do it! (I approve of the idea, I haven't carefully reviewed the code.)
I'm OK with this given the discussion on the issue; will take another look at the code soon. |
Reminder for this: the 3.14 beta freeze is in two weeks. |
https://bugs.python.org/issue43923
NamedTuple
can't inherit from another class #116241