[issue5186] Reduce hash collisions for objects with no __hash__ method
Mark Dickinson
report at bugs.python.org
Thu Feb 12 09:57:26 CET 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
> > - avoids comparing an unsigned long to -1
Just out of interest, why? The cast is unnecessary: there's no ambiguity
or undefinedness (the int -1 gets promoted to unsigned long, with
wraparound semantics), and neither gcc nor MSVC complains.
Other than that, the patch looks fine to me; x ^= x >> 4 would be fine
too. I really don't see that it makes much difference either way, since
both transformations are reversible and fast enough.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5186>
_______________________________________
More information about the Python-bugs-list
mailing list