From: Vivien Maisonneuve Date: Thu, 19 Jun 2014 07:15:55 +0000 (+0200) Subject: Fix Expression.__hash__ X-Git-Tag: 1.0~237 X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/commitdiff_plain/383296fc80db17317dd385821265003c01134f50?ds=inline;hp=288355579f9b2160e341e1d48910a66a0124ab04 Fix Expression.__hash__ --- diff --git a/pypol/linear.py b/pypol/linear.py index 8f73fd3..2c71c02 100644 --- a/pypol/linear.py +++ b/pypol/linear.py @@ -271,7 +271,7 @@ class Expression: self.constant == other.constant def __hash__(self): - return hash((self._coefficients, self._constant)) + return hash((tuple(sorted(self._coefficients.items())), self._constant)) def _toint(self): lcm = functools.reduce(lambda a, b: a*b // gcd(a, b),