Calling sorted( ) in
|
new_operands.extend(sorted(result)) |
fails with SymPy, as SymPy objects are not comparable with operators (
<,
<=,
>,
>=). Operators are overloaded in SymPy to create instances of inequality objects.
SymPy has a function called default_sort_key meant to deal with this problem:
from sympy import symbols
x, y, z = symbols("x y z")
from sympy.core.compatibility import default_sort_key
sorted([z, x, y], key=default_sort_key)
The question is, is it possible to modify MatchPy to specify a custom sorting key so that SymPy can specify the way its objects should be sorted?
Or is it an issue with Multiset?
Calling
sorted( )inmatchpy/matchpy/functions.py
Line 87 in 5cae3f2
fails with SymPy, as SymPy objects are not comparable with operators (
<,<=,>,>=). Operators are overloaded in SymPy to create instances of inequality objects.SymPy has a function called
default_sort_keymeant to deal with this problem:The question is, is it possible to modify MatchPy to specify a custom sorting key so that SymPy can specify the way its objects should be sorted?
Or is it an issue with
Multiset?