[Tutor] hash value input

Kent Johnson kent37 at tds.net
Sat Jan 30 13:35:56 CET 2010


On Sat, Jan 30, 2010 at 4:56 AM, spir <denis.spir at free.fr> wrote:

> I'm surprised of this, for this should create as many indexes (in the underlying array actually holding the values) as there are integer keys. With possibly huge holes in the array. Actually, there will certainly be a predefined number of indexes N, and the integers be further "modulo-ed" N. Or what?
> I would love to know how to sensibly chose the number of indexes. Pointers welcome (my searches did not bring any clues on the topic).

Wikipedia has an extensive article on hash tables.

For details of the Python implementation, there are many comments in the source:
http://svn.python.org/view/python/trunk/Objects/dictobject.c?view=markup

and more implementation notes here:
http://svn.python.org/view/python/trunk/Objects/dictnotes.txt?view=markup

Kent


More information about the Tutor mailing list