[Patches] [ python-Patches-1397711 ] Fix dict and set docs, re: immutability

SourceForge.net noreply at sourceforge.net
Wed Feb 7 22:05:01 CET 2007


Patches item #1397711, was opened at 2006-01-05 07:28
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1397711&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Collin Winter (collinwinter)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Fix dict and set docs, re: immutability

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2007-02-07 16:05

Message:
Logged In: YES 
user_id=80475
Originator: NO

Fixed in revisions 53657 and 53658.

----------------------------------------------------------------------

Comment By: Anthony Baxter (anthonybaxter)
Date: 2006-07-25 03:23

Message:
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. 



----------------------------------------------------------------------

Comment By: Collin Winter (collinwinter)
Date: 2006-01-20 08:07

Message:
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.

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2006-01-13 17:09

Message:
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.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1397711&group_id=5470


More information about the Patches mailing list