Python Dictionary Algorithm Question

Christian Heimes lists at cheimes.de
Tue Dec 16 13:12:08 EST 2008


Brigette Hodson schrieb:
> Hello! I am in a beginning algorithms class this semester and I am working
> on a presentation. I want to discuss in some detail the algorithm python
> uses to determine the hash function for python dictionaries. Does anyone
> know what this algorithm is? Or where I can go to find information on it?

Python's dict implementation doesn't have its own hashing algorithm. It
completely relies upon the __hash__() function and the __eq__()
comparison function of the objects that are used as keys.

The source repository contains a document with some insights. Make your
you read dictnotes.txt and the cmments in dictobject.c
http://svn.python.org/view/python/branches/release25-maint/Objects/

Christian




More information about the Python-list mailing list