hashing an array - howto
John Machin
sjmachin at lexicon.net
Fri Sep 5 19:30:35 EDT 2008
On Sep 6, 7:49 am, bearophileH... at lycos.com wrote:
> John Machin:
>
> > Consider this:>>> hash(123) == hash(123.0) == hash(123L)
> > True
>
> Right... Can you explain me why Python designers have chosen to build
> a hash() like that?
I can't channel them; my rationalisation is this:
Following the Law of Least Astonishment,
>> 123 == 123.0 == 123L
True
Consequently if x == y, then adict[x] and adict[y] should give the
same result.
Cheers,
John
More information about the Python-list
mailing list