[Python-Dev] Proposed change to logging.basicConfig

Matthew Woodcraft matthew at woodcraft.me.uk
Tue Mar 29 22:02:45 CEST 2011


Terry Reedy  <tjreedy at udel.edu> wrote:
> I am bothered by mutually exclusive parameters. This is one reason I was
> glad to see cmp eliminated from list.sort. Quick: what happens if one
> passes both cmp and key to list.sort? There are three reasonable
> possibilities. As far as I can read, the answer is not documented.#

> # Experiment with 2.7 shows that cmp wins. Though too late to change, I
> consider this the worst choice of three. I think an exception should be
> raised. Failing that, I think key should win on the basis that if one
> adds a 'new-fangled' key func to an existing call with cmp (and forgets
> to remove cmp), the key func is the one intended. Also, the doc clearly
> indicates that key is considered superior to cmp.

Neither 'wins': cmp is applied to the output of key.

I agree that it would have been worth documenting this explicitly.

-M-



More information about the Python-Dev mailing list