This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients benjamin.peterson, cool-RR, rhettinger
Date 2010-09-10.18:20:44
SpamBayes Score 5.465064e-05
Marked as misclassified No
Message-id <1284142846.9.0.956699854831.issue9823@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2010-09-10 18:20:46rhettingersetrecipients: + rhettinger, benjamin.peterson, cool-RR
2010-09-10 18:20:46rhettingersetmessageid: <1284142846.9.0.956699854831.issue9823@psf.upfronthosting.co.za>
2010-09-10 18:20:45rhettingerlinkissue9823 messages
2010-09-10 18:20:44rhettingercreate