Message116034
That is the documented and tested behavior: http://docs.python.org/library/collections.html#ordereddict-objects
"""
Equality tests between OrderedDict objects are order-sensitive and are implemented as list(od1.items())==list(od2.items()). Equality tests between OrderedDict objects and other Mapping objects are order-insensitive like regular dictionaries. This allows OrderedDict objects to be substituted anywhere a regular dictionary is used.
"""
It was a basic design objective for OrderedDicts to be substitutable for regular dictionaries (that is why it subclasses from dict). This lets an OD be used just about anywhere in Python where a regular dict is expected.
Also look at: http://en.wikipedia.org/wiki/Liskov_substitution_principle |
|
Date |
User |
Action |
Args |
2010-09-10 18:20:46 | rhettinger | set | recipients:
+ rhettinger, benjamin.peterson, cool-RR |
2010-09-10 18:20:46 | rhettinger | set | messageid: <1284142846.9.0.956699854831.issue9823@psf.upfronthosting.co.za> |
2010-09-10 18:20:45 | rhettinger | link | issue9823 messages |
2010-09-10 18:20:44 | rhettinger | create | |
|