Newbie question about dictionaries
Gerhard Haering
gerhard.haering at gmx.de
Mon Jul 29 10:22:25 EDT 2002
In article <ai3hvh$2a8n$1 at gavrilo.mtu.ru>, Vladimir Cherepanov wrote:
> I've read that dictionaries are implemented as hash tables. Is there any way
> to specify a hash function?
Sure there is. You need to implement a __hash__ method. It's described here:
http://www.python.org/doc/current/ref/customization.html
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list