[docs] [issue21782] hashable documentation error: shouldn't mention id

Giacomo Alzetta report at bugs.python.org
Mon Jun 16 21:24:48 CEST 2014


Giacomo Alzetta added the comment:

"their hash value is their id()" seems quite clearly stating that:

>>> class A: pass
... 
>>> a = A()
>>> hash(a) == id(a)

should be true, but:

>>> hash(a) == id(a)
False

(both in python2 and in python3)

The python 2 documentation for the __hash__ special method *does* state that the default implementation returns a value "derived" by id().
I believe there is an inconsistency. In the python2 glossary it should say:

"their hash value is derived from their id()"

While in python3 it shouldn't mention id() at all, since the documentation for __hash__ doesn't mention it at all.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21782>
_______________________________________


More information about the docs mailing list