"Natural" use of cmp= in sort
paddy3118 at gmail.com
Tue Nov 11 04:09:49 CET 2014
On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote:
> Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently.
> In answering this question, http://stackoverflow.com/a/26850434/10562 about ordering subject to inequalities it seemed natural to use the cmp= argument of sort rather than key=.
> The question is about merging given inequalities to make 1 inequality such that the inequalities also stays true.
Thanks Peter, Ian. I have modified my code to expand transitive relations and ask you to view it on stackoverflow via the original link (as posting code on newsgroups is an ugly hack).
My main reason for the post to c.l.p remains though; it seems like a *natural* use of the cmp= comparator function to sorted rather than using key= .
More information about the Python-list