I've found that sorting the args at creation time solves lots of problems. I have not found that this sorting causes any performance issues in SymPy. Sorting is fairly efficient and no one uses FiniteSets for huge sets.
On Tue, Jul 3, 2012 at 7:36 AM, Sergiu Ivanov <unlimitedscol...@gmail.com>wrote: > Hello, > > FiniteSet currently relies on Basic.sort_key, which produces the sort > key by iterating .args, in the order in which they are stored. Since > FiniteSet.args are obtained from an (unordered) frozenset at > construction, Basic.sort_key produces different (and hence, > hash-dependent) sort keys. This does sometimes influence the sorting > order, and it happens exactly so in a part of the code I'm currently > working on. > > A dumb and obvious solution would be to sort the elements of > FiniteSet.args before producing the sort key, but that sounds ugly and > inefficient. However, I haven't managed to think of a better way. > > Do you have any ideas? > > 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. > > -- 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.