Updates:
        Status: Started

Comment #2 on issue 2674 by vlada.pe...@gmail.com: Remove the cmp_to_key() helper function
http://code.google.com/p/sympy/issues/detail?id=2674

Well, this was embarrassingly simple to fix actually. As you said, most of the uses of Basic.compare_pretty can be replaced seamlessly with default_sort_key, and I've done just that in a branch. Unfortunately, there's a use in core/mul.py that cannot be just replaced with default_sort_key. Per a comment there, it's used just to assure a canonical ordering, but if I use default_sort_key, I get the following error (twice in two different core tests):

File "/home/vperic/devel/sympy/sympy/core/tests/test_expr.py", line 183, in test_leadterm
    assert (1/x**2+1+x+x**2).leadterm(x)[1] == -2
  File "/home/vperic/devel/sympy/sympy/core/expr.py", line 1860, in leadterm
raise ValueError("cannot compute leadterm(%s, %s), got c=%s" % (self, x, c)) ValueError: cannot compute leadterm(x**2 + x + 1 + x**(-2), x), got c=x**(-2)

As this is kinda deep down the core code I'm a little confused. Aaron, do you have any ideas? That's the last use of cmp_to_key. (I guess when I was first converting, this was what I tried to convert and gave up, instead preferring to add the cmp_to_key wrapper)

In any case, I've pushed my work to my github. It's on top of smichr's pull request 590 as those errors were annoying me. See it at: https://github.com/vperic/sympy/tree/cmp_to_key

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to