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 <rep...@bugs.python.org>
<http://bugs.python.org/issue21782>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to