upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

Equal intervals have different hashes #225

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The current hash() implementation for mpi instances does not return identical 
hashes for equal objects:

>>> import mpmath
>>> a = mpmath.mpi(10, 30)
>>> b = mpmath.mpi(10, 30)
>>> a == b
True
>>> hash(a) == hash(b)
False

Since intervals are immutable (correct me if I'm wrong), it would be nice to 
have equal hashes for equal objects, especially for use in sets and dicts.

mpmath: SVN  (> 0.17)
python2.7

Original issue reported on code.google.com by damien.d...@gmail.com on 29 Mar 2012 at 3:38

GoogleCodeExporter commented 9 years ago
Thanks for the bug report.

I pushed a fix here: 
https://github.com/fredrik-johansson/mpmath/commit/61b9a7a68d31bd0f004290f9d24fd
c372b424eb7

Original comment by fredrik....@gmail.com on 29 Mar 2012 at 3:52