[issue39775] inspect.Signature.parameters should be an OrderedDict, not a plain dict
Antony Lee
report at bugs.python.org
Thu Feb 27 08:47:39 EST 2020
New submission from Antony Lee <anntzer.lee at gmail.com>:
https://bugs.python.org/issue36350 / https://github.com/python/cpython/pull/12412 changed Signature.parameters and BoundArguments.arguments to be plain dicts, not OrderedDicts (for Py3.9a4). Even though I agree for BoundArguments.arguments (in fact I argued for this behavior in https://bugs.python.org/issue23080), I think Signature.parameters should remain OrderedDicts. Otherwise, one would get
>>> inspect.signature(lambda x, y: None).parameters == inspect.signature(lambda y, x: None).parameters
True
which seems plain wrong (comparing the signature objects themselves still correctly return False because __eq__ explicitly considers parameter order, but one may e.g. want to compare parameters for equality while ignoring the return annotation).
----------
components: Library (Lib)
messages: 362800
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: inspect.Signature.parameters should be an OrderedDict, not a plain dict
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39775>
_______________________________________
More information about the Python-bugs-list
mailing list