[issue45093] Add method to compare dicts accounting for order

Michael Rans report at bugs.python.org
Fri Sep 3 14:57:00 EDT 2021


Michael Rans <mcarans at yahoo.co.uk> added the comment:

Thank you. Another case is in round trip processing of JSON or YML. Other cases are where you would prefer an OrderedDict over a dict. 

I think the method would help clarify things because it would make it obvious that it is for ordered comparisons while the existing == does not do that.

eg. something like:
d1.compare_ordered(d2)
or:
d1.compare(d2, ordered=True)  # ordered could be by default True

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45093>
_______________________________________


More information about the Python-bugs-list mailing list