classification
Title: "Built-in Types" doc doesn't explain dict comparison.
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, gdr@garethrees.org, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2015-06-08 11:32 by gdr@garethrees.org, last changed 2015-06-12 20:52 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
dict-equality.patch gdr@garethrees.org, 2015-06-08 11:32 review
Messages (3)
msg244998 - (view) Author: Gareth Rees (gdr@garethrees.org) * (Python triager) Date: 2015-06-08 11:32
The "Built-in Types" section of the library documentation does not explain how two dictionaries are compared for equality.

The place where this is documented is under "Comparisons" in the Language Reference:

> Mappings (dictionaries) compare equal if and only if they have the same (key, value) pairs.

but it is not obvious from the section on dictionaries in "Built-in Types" that this is where to look.

(Contrast with the situation for sequences and sets, where "Built-in Types" does explain how these objects are compared for equality.)

I suggest that the "Built-in Types" section should explain how two dictionaries are tested for equality.
msg245274 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-06-12 20:12
The 3.4 sequence section also has this: "Sequences of the same type also support comparisons. In particular, tuples and lists are compared lexicographically by comparing corresponding elements."  I agree that dicts should have a similar sentence or two. Neither the sequence or (frozen)set sections reference the language manual, so I will leave that out.
msg245275 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-06-12 20:49
New changeset d775fad1db43 by Terry Jan Reedy in branch '2.7':
Issue #24406: Add sentences on dict comparisons, similar to those for Sequence
https://hg.python.org/cpython/rev/d775fad1db43

New changeset 4e816c324846 by Terry Jan Reedy in branch '3.4':
Issue #24406: Add sentences on dict comparisons, similar to those for Sequence
https://hg.python.org/cpython/rev/4e816c324846
History
Date User Action Args
2015-06-12 20:52:34terry.reedysetstatus: open -> closed
resolution: fixed
stage: resolved
2015-06-12 20:49:33python-devsetnosy: + python-dev
messages: + msg245275
2015-06-12 20:12:48terry.reedysetnosy: + terry.reedy
title: "Built-in Types" documentation doesn't explain how dictionaries are compared for equality -> "Built-in Types" doc doesn't explain dict comparison.
messages: + msg245274

versions: + Python 2.7, Python 3.4, Python 3.5, Python 3.6
2015-06-08 11:33:51gdr@garethrees.orgsettitle: "Bulit-in Types" documentation doesn't explain how dictionaries are compared for equality -> "Built-in Types" documentation doesn't explain how dictionaries are compared for equality
2015-06-08 11:32:38gdr@garethrees.orgcreate