-
Notifications
You must be signed in to change notification settings - Fork 14.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
Replace OrderedDict with plain dict #33508
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.
Indeed, python dict is ordered since 3.7
Needs to solv conflicts with main. |
Personally I still like to use OrderedDict, especially for things that explicitly depend on the ordering, such as the executor queue. But I guess this is subjective. |
I used to think the same, but after moving to 3.7 and then 3.8, it's already past the Python minor version where it's been not only working like that (3.6) but also official (3.7). And I think it's better to use it when it really matters - especially that there are cases we potentially want to to specifically use OrderedDict (and ones that are highly unlikely to be incorporated into regular dict). After adding reversed to a regular dict in 3.8 (which means we can use it now), there are still two things that really make a difference between regular and Ordered dicts that matters.
So I guess it's better to use OrderedDict when we want to make use of one of those properties. I looked through the changes and does not seem either order-sensitive equality of re-arranging is used/intended to be used :). |
(cherry picked from commit 63e6eab)
Python dicts are ordered, so we do not need to use
collections.OrderedDict
.