◐ Shell
clean mode source ↗

gh-104050: Add more type annotations to Argument Clinic by erlend-aasland · Pull Request #104628 · python/cpython

Comment on lines +2304 to +2305

self.modules: ModuleDict = collections.OrderedDict()
self.classes: ClassDict = collections.OrderedDict()

Choose a reason for hiding this comment

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

Since we're touching these lines anyway: do these need to be OrderedDicts anymore? Regular dicts are guaranteed by the language spec to be ordered on 3.7+ (and clinic now requires 3.10+), and regular dicts are faster than OrderedDicts. OrderedDicts are mainly there for backwards compatibility these days (they have a few fancy methods that dicts don't have, but I really doubt we need any of them in clinic.py).

Choose a reason for hiding this comment

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

Could leave this to another PR, though

Choose a reason for hiding this comment

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

Yes, regular dicts should be fine post 3.7.