[Python-Dev] Counting collisions for the win (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Jan 22 21:13:32 CET 2012


I think this thread is approaching the recursion limit. Be careful not to blow the stack :)

Regards

Antoine.

On Sun, 22 Jan 2012 20:53:41 +0100 Lennart Regebro <regebro at gmail.com> wrote:

On Sun, Jan 22, 2012 at 11:11, Victor Stinner <victor.stinner at haypocalc.com> wrote: >> This seed is chosen randomly at runtime, but cannot >> change once chosen. > > The hash is used to compare objects: if hash(obj1) != hash(obj2), > objects are considered different. So two strings must have the same > hash if their value is the same. > >> Salt could also be an appropriate term here, but since salt is >> generally changed on a per-use basis (a single process may use many >> different salts), seed is more correct, since this value is only >> chosen once per process. > > We may use a different salt per dictionary.

Can we do that? I was thinking of ways to not raise errors when we get over a collision count, but instead somehow change the way the dictionary behaves when we get over the collision count, but I couldn't come up with something. Somehow adding a salt would be one possibility. But I don't see how it's doable except for the string-keys only case mentioned before. But I might just be lacking imagination. :-) //Lennart



More information about the Python-Dev mailing list