[Python-Dev] cpython: Describe the default hash correctly, and mark a couple of CPython (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Sun May 20 12:09:00 CEST 2012
- Previous message: [Python-Dev] PEP 3135 (new super()) __class__ references broken in 3.3
- Next message: [Python-Dev] cpython: Describe the default hash correctly, and mark a couple of CPython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 20 May 2012 10:31:01 +0200 nick.coghlan <python-checkins at python.org> wrote:
+ + .. impl-detail:: + + CPython uses
hash(id(x))
as the default hash for class instances.
This isn't true:
class C: pass ... c = C() hash(c) 619973 id(c) 9919568 hash(id(c)) 9919568
id(...) always has the lower bits clear, so it was decided to shift it to the right by a number of bits.
Regards
Antoine.
- Previous message: [Python-Dev] PEP 3135 (new super()) __class__ references broken in 3.3
- Next message: [Python-Dev] cpython: Describe the default hash correctly, and mark a couple of CPython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]