-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-32473: Improve ABCMeta._dump_registry() readability #5091
Conversation
would you add news entry? |
Done! |
Lib/abc.py
Outdated
@@ -173,6 +173,8 @@ def _dump_registry(cls, file=None): | |||
for name in sorted(cls.__dict__.keys()): |
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.
sorted() is not needed anymore because dict order is stable.
Other option is whitelist members ('_abc_registry', '_abc_cache', '_abc_negative_cache', '_abc_negative_cache_version')
.
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 would prefer the whitelist: a suitable order increase also readability...
But I think to stick with if name.startswith("_abc_")
is easier to maintain.
I was told that this will be rewritten in C, so it's not a big deal.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I have made the requested changes; please review again |
Thanks for making the requested changes! @methane: please review the changes made to this pull request. |
thanks |
Hm, I think this is safe enough to backport to 3.6. |
Thanks @yahya-abou-imran for the PR, and @methane for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6. |
GH-5163 is a backport of this pull request to the 3.6 branch. |
(cherry picked from commit ae12f5d)
https://bugs.python.org/issue32473