Roundup Robot added the comment:
New changeset bfaf434a6f10 by Georg Brandl in branch '3.4':
Closes #21782: the default hash(x) is not exactly id(x) but derived from it.
https://hg.python.org/cpython/rev/bfaf434a6f10
--
nosy: +python-dev
resolution: -> fixed
stage: -> resolved
status:
R. David Murray added the comment:
Yes, I should have been clearer. By "poorly worded" I meant "id is involved,
but the sentence does not correctly describe *how* id is involved". That is,
the sentence is wrong as written.
The implementation is the same in both Python2 and Python3, though th
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 m
R. David Murray added the comment:
The statement is poorly worded. The id() is the *input* to the hash function
used to compute the default __hash__. This is a CPython implementation detail,
though, so perhaps all mention of it should indeed be dropped.
--
nosy: +r.david.murray
New submission from Giacomo Alzetta:
The documentation for hashable in the glossary
(https://docs.python.org/3.4/reference/datamodel.html#object.__hash__) is
incorrect:
they all compare unequal (except with themselves), **and their hash value is
their id().**
It is *not* true that their hash