I don't think the key makes any guarantees, other than that the prefer will be platform and python version independent. It also should be very hard to produce two different objects with the same key.
It was probably originally designed to give the same ordering to reduce the pain of transition, but I don't see any reason why it should stay that way forever. Aaron Meurer Sent from my iPhone. > On Oct 2, 2013, at 2:53 PM, Matthew Brett <matthew.br...@gmail.com> wrote: > > Hi, > > I just noticed this: > > In [38]: a = sympy.Symbol('a') > > In [39]: b = sympy.Dummy('b') > > In [40]: sorted([a, b]) > Out[40]: [a, _b] > > In [41]: sorted([a, b], key=sympy.default_sort_key) > Out[41]: [_b, a] > > for sympy versions 0.7.0 through 0.7.3. Sorting without a key raises > an error for current trunk. > > Is the difference between 'sort' and 'sort(key=default_sort_key)' intended? > > I guess, now sympy raises an error without a key, there isn't much to > do, but maybe the change is worth recording, even if only in this > email. > > Thanks, > > Matthew > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.