New submission from Ram Rachum <cool...@cool-rr.com>:

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

----------
components: Library (Lib)
messages: 116027
nosy: cool-RR
priority: normal
severity: normal
status: open
title: OrderedDict is comparable to dict
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
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