On Sat, Jun 30, 2012 at 2:36 PM, Joachim Durchholz <j...@durchholz.org> wrote: > Am 30.06.2012 13:13, schrieb Sergiu Ivanov: > >> However, I'll try once again to push through the idea of defining >> sympy.utilities.sympysort in the following way: >> >> sympysort(x) = sorted(x, key=default_sort_key) >> >> This will make the doctests which output non-Basic objects uglier, but >> not less clearer with sympysort. > > > Doctests are code examples made executable to avoid the embarrassment of > having non-working example code. > Adding code to make the doctest pass will make the code example less useful > in its primary purpose.
Good point, will keep in mind, thank you. > Alternatively, we could push sympysort into standard equality testing. Note that I suggested applying sympysort to _non-Basic_ things only. Basic objects (i.e., inherently SymPyish objects) will be handled by sorting their .args at printing. Therefore, the change I propose would be totally transparent in "most" cases. > This could be done in two ways: > 1) Change SymPy to use its own equality testing function(s). I believe that > this could benefit other problems - I see recurring questions of the "a and > b should be equal but aren't" on the mailing list, and having an array of > different equality testers that work at different levels of abstractions > might help address this without the feel of ugly hacks that the answers > often carry. This is beyond the scope I had in mind when writing my previous E-mail, which means that I don't claim to be of any authority on this point :-) Do bear in mind, however, that playing around with equality testing functions will _not_ address the doctest failures because the problem most often arises from _string_ comparison in doctesters. > 2) If Python supports that, redefine Python's equality for SymPy dicts to be > agnostic of key ordering. That would push sympysort into the equality > function. (Making this efficient might be an interesting task.) SymPy dicts are Basic objects, so you I believe you can do whatever you want with them. Nevertheless, my impression from the test (not doctest) failures we see is that they have nothing to do with comparison of SymPy dicts. Again, do remember that I have only considered doctest failures so far, so what I say about unrelated things is pure speculation :-) Sergiu -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.