On Sat, Jun 30, 2012 at 12:24 AM, Ondřej Čertík <ondrej.cer...@gmail.com> wrote: > On Fri, Jun 29, 2012 at 1:06 PM, Sergiu Ivanov > <unlimitedscol...@gmail.com> wrote: >> On Sun, Jun 24, 2012 at 10:41 AM, Sergiu Ivanov >> <unlimitedscol...@gmail.com> wrote: >>> >>> On Sun, Jun 24, 2012 at 8:32 AM, Aaron Meurer <asmeu...@gmail.com> wrote: >>>> >>>> And lastly, if anyone has any thoughts on how we could canonically >>>> order the arguments of Add and Mul independent of hash values, but is >>>> still just as fast as hash values, I would love to hear it. If we >>>> could do that, it would make fixing these errors a lot easier (on the >>>> other hand, maybe we would be better off design-wise if we made >>>> everything .arg ordering agnostic). >>> >>> From my recent experience, using sympy.utilities.misc.default_sort_key >>> is a nice way to canonically order things. As far as I can see in the >>> code, it doesn't seem to rely on hashes for sorting; instead, it >>> provides sort keys which are tuples often (not sure how often) >>> including native numbers and strings. I *think* it's not going to be >>> just as fast as hash-based ordering, but, I guess, it's going to be >>> one of the fastest approaches, because, eventually, simple native >>> types will be compared. >> >> So, what is the official position as far as sorting the arguments of >> Mul and Arg is concerned? I have seen you say that things should be >> made to work independently of the ordering; is that the current >> strategy? > > I think that there is a huge speed penalty for sorting the actual arguments. > So I think that the only solution really is to not sort the argument, > but make all results hash independent, by sorting the printing (which we do) > and fixing other bugs.
OK, I see. Thank you for the explanation! 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.