[Python-ideas] Fwd: Why do equality tests between OrderedDict keys/values views behave not as expected?

Alexandre Figura ipipomme+python at gmail.com
Thu Dec 17 04:40:33 EST 2015


Hi,

I recently compared OrderedDict instances while writing unit tests, and
discovered an interesting behavior. If I create two ordered dictionaries
with the same keys/values in the same order, I observe that their values
are not equal when I compare them.

I recently asked a question about this on Stackoverflow:
http://stackoverflow.com/questions/34312674/why-values-of-an-ordereddict-are-not-equal

Moreover, another user observed that keys of ordered dictionaries are
compared in an order insensitive way:
http://stackoverflow.com/questions/34320600/why-does-the-ordereddict-keys-view-compare-order-insensitive

Are there any reasons for such implementation choices? As it appears
disturbing for many people, would it be possible to update these behaviors?

Best Regards,
Alexandre.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151217/2c7d2db6/attachment-0001.html>


More information about the Python-ideas mailing list