[New-bugs-announce] [issue5186] Reduce hash collisions for objects with no __hash__ method

Mark Dickinson report at bugs.python.org
Sun Feb 8 17:36:18 CET 2009


New submission from Mark Dickinson <dickinsm at gmail.com>:

In the issue 5169 discussion, Antoine Pitrou suggested that for an object 
x without a __hash__ method, id()/8 might be a better hash value than 
id(), since dicts use the low order bits of the hash as initial key, and 
the 3 lowest bits of an id() will always be zero.

Here's a patch.

----------
components: Interpreter Core
files: pointer_hash.patch
keywords: patch
messages: 81389
nosy: marketdickinson, pitrou, rhettinger
priority: normal
severity: normal
status: open
title: Reduce hash collisions for objects with no __hash__ method
type: performance
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file12977/pointer_hash.patch

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


More information about the New-bugs-announce mailing list