Difference of hash and __hash__()
Terry Reedy
tjreedy at udel.edu
Wed Sep 3 12:10:32 EDT 2003
"Stefan Fleiter" <stefan.fleiter at web.de> wrote in message
news:bj4dhh$24s$1 at news.web.de...
> So, should I write a bugreport or not?
> Are you sure it is "rightfully ignored" or not?
At worse, a bug report such 'Slice hashing: behavior or doc bug?'
would be closed by someone in the know as 'Not a bug'. If it is not a
behavior bug, then docs could use slight modification, and so a bug
report would be appropriate anyway.
Ref Manual 5.3.3 Slicings says nothing about hashability. If not
hashable, in spite of being mutable, "Slices are not hashable" could
be added at end.
Ref Manual 3.3.1 Basic customization, __hash__( self) entry says
"Called for the key object for dictionary operations, and by the
built-in function hash() "
This implies to me that if there is a __hash__() method, then hash()
will call it. If not true, then a 'maybe' could be added.
Lif Maual 2.1 Built-in Functions, hash( object) says only
"Return the hash value of the object (if it has one)."
If having __hash__() does not mean 'has one', then what does.
Feel free to copy if you do file.
Terry J. Reedy
More information about the Python-list
mailing list