Documentation is a very good idea.
Maybe, even raise an error when comparing values.
On 20.01.2016 12:13, Alexandre Figura
If we put technical considerations aside, maybe we
should just ask to ourselves what behavior do we expect
when doing equality tests between ordered dictionaries. As
>>> xy = OrderedDict([('x', None), ('y', None)])
>>> yx = OrderedDict([('y', None), ('x', None)])
>>> xy == yx
>>> xy.items() == yx.items()
>>> xy.keys() == yx.keys()
>>> xy.values() == yx.values()
So, it appears that:
1. equality tests between odict_values use objects
identity and not equality,
2. equality tests between odict_keys do not respect order.
If it is not technically possible to change the current
implementation, maybe all we can do is just add a warning
about current behavior in the documentation?
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/