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: Missing def'n of equality for set elements
Type: Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, skip.montanaro
Priority: normal Keywords:

Created on 2005-04-09 22:10 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg24971 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2005-04-09 22:10
The documentation of the sets module doesn't describe the
properties of set elements that they must have to properly
work in sets (at least I didn't see it described).  In creating a
set of instances, I had to sort of stumble around and
discover that the class needed to define both __eq__ and
__hash__.  Either alone didn't seem to work.  Perhaps I've
got it all wrong and there's a better way to do things.  It would
be nice if the docs described things officially though.


msg24972 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-04-10 17:20
Logged In: YES 
user_id=80475

It does say that sets are implemented using dictionaries.  That 
implies that the requirements for set elements are the same as for 
dictionary keys.

Will see if I can add some clarifying wording.
msg24973 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-04-10 17:30
Logged In: YES 
user_id=80475

Updated both libstdtypes.tex and libsets.tex with explicit 
documentation for element requirements.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41832
2005-04-09 22:10:45skip.montanarocreate