Message220750
"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. |
|
Date |
User |
Action |
Args |
2014-06-16 19:24:48 | Giacomo.Alzetta | set | recipients:
+ Giacomo.Alzetta, r.david.murray, docs@python |
2014-06-16 19:24:48 | Giacomo.Alzetta | set | messageid: <1402946688.19.0.885777148748.issue21782@psf.upfronthosting.co.za> |
2014-06-16 19:24:48 | Giacomo.Alzetta | link | issue21782 messages |
2014-06-16 19:24:48 | Giacomo.Alzetta | create | |
|