-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-135575: MutableMapping.update
: use .items()
in the Mapping
case.
#135576
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
gh-135575: MutableMapping.update
: use .items()
in the Mapping
case.
#135576
Conversation
b78241b
to
d6f4c82
Compare
@@ -0,0 +1 @@ | |||
Improved performance of ``MutableMapping.update``. |
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.
Improved performance of ``MutableMapping.update``. | |
Improved performance of :meth:`MutableMapping.update`. |
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 actually tried this one first, but CI complained that it cannot find the RST-reference.
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.
Ah sorry about that. It probably should be something like :meth:`collections.abc.MutableMapping.update`.
I don't think this should change. This is Guido's code and he designed it to only depend on the abstract methods required by the API rather than downstream mixins. Also, this would be a change in behavior if In general, the ABC mixin methods have been designed as plainly as possible to serve as a specification or guide to implementers. They are not in the optimization business. |
There are already plenty of places where one mixin depends on other mixins:
|
Nevertheless, it would be a change in behavior and it alters Guido's intentional design choices. |
Thanks @rhettinger. The methods here exist to specify the semantics, not as a performant basis for subclasses. |
@rhettinger Does the same reasoning also apply to #135312? |
MutableMapping.update
performance improvement #135575