[docs] [issue9132] Documentation for comparing dictionaries is out of date

Terry J. Reedy report at bugs.python.org
Sun Jul 4 06:20:09 CEST 2010

Terry J. Reedy <tjreedy at udel.edu> added the comment:

The RefMan section is 5.9. Comparisons. The 3.x docs are by design pretty much free of 2.x references. Which is to say, they are a fresh start with 3.0 as the base. So I would also remove footnote 5. Footnote 4 is currently needed because the text suggests something that is not true. Instead fix the text and remove 4.

 I verified both behavior claims with 3.1:
>>> d1 = {1+1j: 2, 1+2j: 3}
>>> d2 = {1+1j: 2, 1+2j: 3}
>>> d1 == d2
>>> d1 < d2
Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    d1 < d2
TypeError: unorderable types: dict() < dict()

PATCH suggestion: Replace the current entry with

"Mappings (dictionaries) compare equal if and only if they have the same key, value) pairs. Order comparision raise TypeError."

Remove footnotes 4 and 5.

"Comparisons other than equality testing raise a TypeError."
is not quite correct because 'comparisons' include 'is' and 'in' which do work as expected.

keywords: +patch
nosy: +tjreedy
type:  -> behavior

Python tracker <report at bugs.python.org>

More information about the docs mailing list