On Monday, December 5, 2016 at 9:15:50 AM UTC-8, Marc Mezzarobba wrote:
>
>
> I'm not sure I follow you: doesn't what cmp() does (if I understand 
> right: use the internal order when possible, otherwise sort by type and 
> refine by id) do the job? But then, of course, this behavior cannot be 
> implemented as a key function, only as a comparison function... 
>
> There's a transform that allows you to implement any comparison via a key:

https://docs.python.org/2/library/functools.html#functools.cmp_to_key 

See also

https://docs.python.org/3/howto/sorting.html#sortinghowto

for the straightforward implementation that allows you to implement 
whatever comparison you like.

(of course this all doesn't solve the fundamental difficulty that there 
isn't an ordering that is both total and intuitive/mathematically 
meaningful)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to