3 ms·
Not sure about the previous post, but also python’s OrderedDict collection guarantees order-sensitive equality checks. [1] Plain dict maintains insertion order
by sixdimensional 2y ago
Not sure about the previous post, but also python’s OrderedDict collection guarantees order-sensitive equality checks. [1]
Plain dict maintains insertion order but equality checks only check that the key/value pairs are the same. [2] [3]
[1] https://docs.python.org/3/library/collections.html#:~:text=equality%20tests%20between%20ordereddict%20objects%20are%20order%2Dsensitive https://docs.python.org/3/library/collections.html#:~:text=e...
[2] https://docs.python.org/3/library/stdtypes.html#:~:text=dictionaries%20preserve%20insertion%20order.%20 https://docs.python.org/3/library/stdtypes.html#:~:text=dict...
[3] https://docs.python.org/3/library/stdtypes.html#:~:text=dictionaries%20compare%20equal%20if%20and%20only%20if%20they%20have%20the%20same%20(key%2C%20value)%20pairs%20(regardless%20of%20ordering).%20order%20comparisons%20(%E2%80%98%3C%E2%80%99%2C%20%E2%80%98%3C%3D%E2%80%99%2C%20%E2%80%98%3E%3D%E2%80%99%2C%20%E2%80%98%3E%E2%80%99)%20raise%20typeerror. https://docs.python.org/3/library/stdtypes.html#:~:text=dict...