Difference of hash and __hash__()

Stefan Fleiter stefan.fleiter at web.de
Wed Sep 3 11:50:41 CEST 2003


Jeff Epler wrote:

> No, it's apparently deliberate that slices don't hash (so that
> {}[1:2] raises an error).  I think that slice(None).__hash__ is from
> object.__hash__, but this is rightfully(?) ignored by PyObject_Hash()
> which looks at tp_hash (NULL for slice objects) and tp_compare (non-NULL
> for slice objects) with the result that the object is treated as
> unhashable.

So, should I write a bugreport or not?
Are you sure it is "rightfully ignored" or not?

Somewhat puzzled,

More information about the Python-list mailing list