[docs] [issue11712] Doc list.sort(cmp=,key=) result.

Raymond Hettinger report at bugs.python.org
Wed Mar 30 01:40:25 CEST 2011


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

There's no need to guess what it does ;-)  We don't document by experiment when source and test suites are available.  

Mathew was correct, it works as documented:  the key function is applied  at the outset (as it always does) and then cmp function is used whenever a comparison is made (as it always does).  There is no special change in behavior when the two are used together; they are effectively orthogonal (the actual implementation is a bit more complicated).  IMO, the docs are correct as-is.

There is some question about whether to specifically elaborate on what happens when both are used together.  For the most part, users are better-off using either key-functions or cmp-functions but not both at the same time.  We may be doing them a disservice by suggesting otherwise.  

This has been out for several years now and no one has either noticed or cared, so I recommend closing with no change.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11712>
_______________________________________


More information about the docs mailing list