Comment #3 on issue 3968 by [email protected]: factor_list() error
Python3
http://code.google.com/p/sympy/issues/detail?id=3968
Here is an ughly hack that shows where the problem is:
diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py
index c1b3dff..6a14317 100644
--- a/sympy/polys/polytools.py
+++ b/sympy/polys/polytools.py
@@ -5305,6 +5305,14 @@ def sqf_part(f, *gens, **args):
else:
return result
+def listhash(l):
+ r = []
+ for x in l:
+ if isinstance(x, list):
+ r.append(tuple(x))
+ else:
+ r.append(x)
+ return hash(tuple(r))
def _sorted_factors(factors, method):
"""Sort a list of ``(expr, exp)`` pairs. """
@@ -5317,7 +5325,7 @@ def key(obj):
def key(obj):
poly, exp = obj
rep = poly.rep.rep
- return (len(rep), exp, rep)
+ return (len(rep), exp, listhash(rep))
return sorted(factors, key=key)
But I don't know what the best fix is, e.g. how to best compare it. My
above code is slow and does not feel right.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.