[issue30671] dict: simplify and improve lookup function
INADA Naoki
report at bugs.python.org
Thu Jun 15 20:39:25 EDT 2017
INADA Naoki added the comment:
Firstly, do you understand the lookup without perturb?
It's documented here:
https://github.com/python/cpython/blob/258bfc462b1e58689b43f662a10e44ece3a10bef/Objects/dictobject.c#L161-L182
>>> n = 0; L = []
>>> for i in range(16):
... L.append(n)
... n = (n*5+1)%8
...
>>> L
[0, 1, 6, 7, 4, 5, 2, 3, 0, 1, 6, 7, 4, 5, 2, 3]
>>> n = 0; L = []
>>> for i in range(16):
... L.append(n)
... n = (n*2+1)%8
...
>>> L
[0, 1, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]
So you can't use 2.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30671>
_______________________________________
More information about the Python-bugs-list
mailing list