Closed jlbosse closed 10 months ago
Thanks for this. Following your discourse discussion, I put in a PR to PyCall
(https://github.com/JuliaPy/PyCall.jl/pull/1054) which along with the definition hash(x::Sym, h::UInt64) = hash(PyObject(x), h)
should get this done. Let me see if that is accepted and if not, look to solve this within SymPy
.
Currently the implementation of
hash(x::Sym, h::UInt64)
depends on the object id and not value ofx
, whereashash(x::Sym)
depends on the value of x. This leads to counter intuitive behaviour like the following:See also this issue for consequences of the missing hash function and this discussion on discourse for why this is an issue.
I think, and the julia documentation also clearly states, that the hash function should satisfy
x == y
implieshash(x) == hash(y)
.I am happy to create a PR that implements the two-argument version
hash(x::Sym, h::UInt64)
which should fix this; If that is the desired behaviour.