x comes before a and b if you use the wrong one.  Basic.sort_key
wasn't intended to be used that way, so you end up with a strange
ordering.  default_sort_key gives the correct order.

Aaron Meurer

On Wed, Jun 15, 2011 at 5:41 PM, Chris Smith <[email protected]> wrote:
>
>
> On Wed, Jun 15, 2011 at 6:06 PM, Aaron Meurer <[email protected]> wrote:
>>
>> The short answer is that the proper way to call it with sort_key() is
>> sorted([x, a, b], key=lambda i: i.sort_key()).  default_sort_key() is
>> just a shortcut to this lambda expression.  You shouldn't use
>> sort_key() unless you want use a nonstandard order (which is broken
>> right now anyway).
>>
>
> But notice that x comes before a and b ... I was wondering if this is
> intentional and which makes most sense.
>>
>> >>    >>> sorted([x, a, b], key=default_sort_key)
>> >>    [a, b, x]
>> >>    >>> sorted([x, a, b], key=Basic.sort_key)
>> >>    [x, a, b]
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to