[Python-Dev] returning longs from __hash__()

"Martin v. Löwis" martin at v.loewis.de
Tue Aug 8 21:08:56 CEST 2006


Armin Rigo schrieb:
> Maybe the user should just be able to return any integer value from a
> custom __hash__() without having to worry about not exceeding
> sys.maxint.
> 
> After all the returned value has no real meaning.  If a long is returned
> we could take its hash again, and use that number internally.

Nick Coghlan already suggested that, when __hash__ returns a long int,
the tp_hash of long int should be used to compute the true hash value.

Could you see any problems with that approach? If not, and if I don't
hear other objections, I'd like to go ahead and fix it that way.

Regards,
Martin


More information about the Python-Dev mailing list