X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/7f60c3d845f3035ce675bfe4cc0d2d01456013c6..ce545ffab9494e0c8250a8880859b6b097ed544d:/pypol/linexprs.py?ds=inline diff --git a/pypol/linexprs.py b/pypol/linexprs.py index 9a1ed64..73c6b0e 100644 --- a/pypol/linexprs.py +++ b/pypol/linexprs.py @@ -61,7 +61,7 @@ class Expression: self = object().__new__(cls) self._coefficients = OrderedDict() for symbol, coefficient in sorted(coefficients, - key=lambda item: item[0].name): + key=lambda item: item[0].sortkey()): if isinstance(coefficient, Rational): coefficient = coefficient.constant if not isinstance(coefficient, numbers.Rational): @@ -380,6 +380,9 @@ class Symbol(Expression): def dimension(self): return 1 + def sortkey(self): + return self.name, + def issymbol(self): return True