[issue20446] ipaddress: hash similarities for ipv4 and ipv6

Tim Peters report at bugs.python.org
Sat Jun 21 03:31:14 CEST 2014


Tim Peters added the comment:

I'm more puzzled by why `__hash__()` here bothers to call `hex()` at all.  It's faster to hash the underlying int as-is, and collisions in this specific context would still be rare.

@Josh, note that there's nothing bad about getting sequential hash codes in CPython's implementation of dicts.  This is explained in dictobject.c, in the long comment block starting with "Major subtleties ahead:".

In any case, I'm closing this, as nobody has brought up a real problem.

----------
nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list