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.

Author terry.reedy
Recipients georg.brandl, terry.reedy
Date 2008-11-17.21:48:34
SpamBayes Score 7.840617e-12
Marked as misclassified No
Message-id <1226958515.3.0.535002715337.issue4341@psf.upfronthosting.co.za>
In-reply-to
Content
Language/data model/special method names/ __hash__

Sentence 1: "Called for the key object for dictionary operations, and by
the built-in function hash()."

Also called for the members of set and frozenset (and any other hashed
based collection).

Suggestion 1: "Called by the built-in function hash() and for operations
on members or keys of hashed collections. These currently include the
built-in classes set, frozenset, and dict."

Corresponding future-proof changes later in the text:

From "its instances will not be usable as dictionary keys"

to "its instances will not be usable as hashable members or keys".

From "since the dictionary implementation requires"

to "since hashable collection implementations require"
==============================

Sentence 2: "Should return an integer usable as a hash value for
dictionary operations."

I am confused by the qualification 'usable....'.  If it does not
qualify, it is meaningless and should be removed.  If it does qualify,
it should be replaced by what it means.

My impression is that integers of any value are usable since 2.5.

It is also my impression that 2.x specifically requires an int or long.
If so, "Should return an int or long integer." would be clearer.

For 3.0, I don't know what the boundaries are.  A float works, even if
not integral. [bug?] A Fraction does not, even if integral, even though
int(Fraction(n,1)) returns n.
History
Date User Action Args
2008-11-17 21:48:35terry.reedysetrecipients: + terry.reedy, georg.brandl
2008-11-17 21:48:35terry.reedysetmessageid: <1226958515.3.0.535002715337.issue4341@psf.upfronthosting.co.za>
2008-11-17 21:48:34terry.reedylinkissue4341 messages
2008-11-17 21:48:34terry.reedycreate