hashkey/digest for a complex object

Diez B. Roggisch deets at web.de
Thu Oct 7 13:59:54 CEST 2010

kj <no.email at please.post> writes:

> In <m2fwwjazs2.fsf at web.de> deets at web.de (Diez B. Roggisch) writes:
>>kj <no.email at please.post> writes:
>>> The short version of this question is: where can I find the algorithm
>>> used by the tuple class's __hash__ method?
>>Surprisingly, in the source:
> Thanks to you, and to all who pointed me to the place in the source
> where this is.
> How exactly did you search for this?  Taking a hint from the url
> above, I went to Google Code Search and searched for "python tuple
> hash" (minus the quotes, of course), which produced a ton of
> irrelevant stuff (almost 80K hits).  Searching for "python tuple
> hash lang:c" cut down the number of hits to ~8K, but still too much
> to wade through.  Clearly I need a smarter search strategy (one
> that does not include foreknowledge of the name of the actual
> function in the C source, of course).

I tried codesearch first. Not satisfied after 30 seconds with the
results, I did the most straight forward thing - I downloaded and
un-packed the python source... and took a look. 

>From that I learned the tuplehash function name.


More information about the Python-list mailing list