tuple.__hash__()
Just
just at xs4all.nl
Tue Jan 6 03:40:24 EST 2004
In article <pan.2004.01.06.08.17.30.910345 at thomas-guettler.de>,
"Thomas Guettler" <guettli at thomas-guettler.de> wrote:
> Can someone point me to the documentation
> of tuples __hash__ method?
>
> I want to unique a list of tuples. Since
> __hash__ returns a 32 bit integer, there
> could be a situtation where two different tupples
> return the same value.
That's a basic propery of hashing in general, no?
> >>> t1=(1, 2, 3)
> >>> t1.__hash__()
> -821448277
> >>> t2=(1, 2, 3)
> >>> t2.__hash__()
> -821448277
Not sure what your point is here: you're showing that two _equal_ tuples
have the same hash value.
> Is there a dictionary type which uses __cmp__() like
> btrees in the standard library?
I don't think so.
Just
More information about the Python-list
mailing list