-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Replace ordered_set with dict #4574
Conversation
Since Python 3.7, ``dict`` preserve insertion order. This means that ``dict`` is a capable implementation of an ordered set, despite the method names not lining up completely.
Searching for "ordered" in python files, there's a few bits of logic that still assume dicts are unordered. It's getting late here, but I could open a PR in parallel of yours with all those I found. |
@@ -188,7 +188,7 @@ def test_read_metadata(name, attrs): | |||
('requires', dist_class.get_requires), |
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.
Line 313 still contains a reference to "ordered-set==3.1.1" (it's in an example, but may as well remove it)
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'm +0.
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! LGTM.
Summary of changes
This is a follow up of the discussion on #4457 (review).
Since Python 3.7,
dict
preserve insertion order.This means that
dict
is a capable implementation of an ordered set,despite the method names not lining up completely.
We can effectively use
dict
to obtain the same functionality that would be implemented byordered_set
and therefore we can remove the extra dependency.Closes
Pull Request Checklist
newsfragments/
.(See documentation for details)
Optionally, we could have something like
But that would be mostly cosmetic, since we can simply use the
dict
methods directly and obtain the same effects...