This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix dict and set docs, re: immutability
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: anthonybaxter, collinwinter, jimjjewett, rhettinger
Priority: normal Keywords: patch

Created on 2006-01-05 12:28 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
libstdtypes.tex.diff collinwinter, 2006-01-20 13:07 Diff against Doc/lib/libstdtypes.text, r42105
Messages (5)
msg49261 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-01-05 12:28
This patch resolves bug #1368768.

As mentioned in the bug description, the documentation
for sets and dicts incorrectly reports that set members
and dict keys must be immutable. This patch corrects
this, changing references to immutability to
hashability and inserting footnotes describing what is
meant by "hashable".

The patch is a diff against Doc/lib/libstdtypes.tex
from SVN revision 41926.
msg49262 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-01-13 22:09
Logged In: YES 
user_id=764593

Definately an improvement, but it still may not be quite 
right in the footnote.  You don't have to define a __hash__ 
method; you just need to avoid redefining it (or __eq__) to 
something that doesn't work. 

Here is another stab

Hashable objects must define or inherit proper 
\method{__hash__} and \method{__eq__} methods.  Most objects 
do, but some mutable types -- including lists -- redefine 
equality in such a way that the hash code would not be 
stable.  Instead, their hash functions return -1 to indicate 
that the object should not be used as a dict key or set 
member.

msg49263 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-01-20 13:07
Logged In: YES 
user_id=1344176

I've updated the patch to include Jim's version of the
footnote. The new version of the patch is against SVN
revision  42105.
msg49264 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2006-07-25 08:23
Logged In: YES 
user_id=29957

Raymond, this is assigned to you - were you going to check
it in? If not, I will do it. 

msg49265 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-02-07 21:05
Fixed in revisions 53657 and 53658.
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42766
2006-01-05 12:28:06collinwintercreate