Possibly dumb question about dicts and __hash__()

Joel Hedlund joel.hedlund at gmail.com
Wed May 3 16:59:45 EDT 2006


Beautiful!

But how come my attempt didn't work? I've seen docs that explain how __hash__() 
methods are used to put objects in dict buckets:

http://docs.python.org/ref/customization.html#l2h-195

But if it's really hash(str(o)) that's used for dict keys, what good are 
__hash__() methods? Or am I reading the docs wrong?

/Joel



More information about the Python-list mailing list