classification
Title: inspect.Signature.parameters and inspect.BoundArguments.arguments should be dicts instead of OrderedDicts
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: remi.lapeyre, rhettinger, yselivanov
Priority: normal Keywords: patch

Created on 2019-03-18 15:16 by remi.lapeyre, last changed 2020-01-28 12:47 by methane. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12412 merged remi.lapeyre, 2019-03-18 15:19
Messages (3)
msg338238 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-03-18 15:16
Python 3.7.2 (default, Feb 12 2019, 08:15:36) 
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> inspect.Signature().parameters
mappingproxy(OrderedDict())
>>> def foo(a): pass
... 
>>> ba = inspect.signature(foo).bind(1)
>>> ba.arguments
OrderedDict([('a', 1)])
msg360718 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-01-26 04:50
I'm neutral on whether to move this forward or not.  Usually, we would only make an externally visible and possibly consequential API change if there were some compensating benefit to users (a significant speed-up for example).

Also note that the existing code uses move_to_end() so there is some case to be made that OrderedDict() was a reasonable choice even if dict() had been an option from the outset.

I suggest leaving this as-is.
msg360868 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-01-28 12:47
New changeset 2cca8efe46935c39c445f585bce54954fad2485b by Inada Naoki (Rémi Lapeyre) in branch 'master':
bpo-36350: inspect: Replace OrderedDict with dict. (GH-12412)
https://github.com/python/cpython/commit/2cca8efe46935c39c445f585bce54954fad2485b
History
Date User Action Args
2020-01-28 12:47:27methanesetstatus: open -> closed
versions: + Python 3.9, - Python 3.8
nosy: - methane

resolution: fixed
stage: patch review -> resolved
2020-01-28 12:47:22methanesetnosy: + methane
messages: + msg360868
2020-01-26 04:50:10rhettingersetnosy: + rhettinger
messages: + msg360718
2019-03-18 15:20:38xtreaksetnosy: + yselivanov
2019-03-18 15:19:23remi.lapeyresetkeywords: + patch
stage: patch review
pull_requests: + pull_request12366
2019-03-18 15:16:48remi.lapeyrecreate