Issue 9823: OrderedDict is comparable to dict (original) (raw)

OrderedDict is currently comparable to dict.

I think this is not logical, because a dict doesn't have order, and having an identical order is a necessary condition for a match.

I think that comparing an OrderedDict with a dict makes as much sense as comparing a tuple with a set, and that's currently not allowed. (Always returns False)

Here's a disturbing code snippet executed in Python 3.2a1:

from collections import OrderedDict d1 = OrderedDict(((1, 2), (3, 4))) d2 = OrderedDict(((3, 4), (1, 2))) d1 == d2 False d1 == {1: 2, 3: 4} == d2 True