Skip to content
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-104683: Argument clinic: use dict over OrderedDict #104647

Merged
merged 1 commit into from
May 20, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented May 19, 2023

Instances of builtins.dict have been ordered since 3.6, and have been guaranteed by the language to be ordered since Python 3.7. Since Argument Clinic requires Python 3.10+, we can replace usages of OrderedDict with dict. This is less verbose, more readable, and might be slightly more performant. (OrderedDicts have a few features that dicts don't have, but we don't use any of those features in Argument Clinic.)

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice readability improvement. Is collections still used? If not, lets remove the import also.

Also, I think we should stick to the established workflow regarding skip issue; all refactorings require an issue.

@AlexWaygood
Copy link
Member Author

AlexWaygood commented May 19, 2023

Is collections still used? If not, lets remove the import also.

Yes, still used for deque and Counter :)

Also, I think we should stick to the established workflow regarding skip issue; all refactorings require an issue (unless things have changed recently).

Sure, I'll create an issue

@AlexWaygood AlexWaygood changed the title Argument clinic: use dict over OrderedDict gh-104683: Argument clinic: use dict over OrderedDict May 20, 2023
@AlexWaygood AlexWaygood merged commit 02b6003 into python:main May 20, 2023
@AlexWaygood AlexWaygood deleted the nomore-ordereddict branch May 20, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants