Issue 225 in mpmath: Equal intervals have different hashes

8 views
Skip to first unread message

mpm...@googlecode.com

unread,
Mar 29, 2012, 11:38:19 AM3/29/12
to mpmath...@googlegroups.com
Status: New
Owner: ----

New issue 225 by damien.d...@gmail.com: Equal intervals have different
hashes
http://code.google.com/p/mpmath/issues/detail?id=225

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

mpm...@googlecode.com

unread,
Mar 29, 2012, 11:53:25 AM3/29/12
to mpmath...@googlegroups.com

Comment #1 on issue 225 by fredrik....@gmail.com: Equal intervals have
different hashes
http://code.google.com/p/mpmath/issues/detail?id=225

Thanks for the bug report.

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

Reply all
Reply to author
Forward
0 new messages