Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:

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

----------
assignee:  -> rhettinger
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to