Issue 1077353: add key= argument to min and max (original) (raw)

Adds a key= keyword argument to the builtin functions min and max. This argument works just like key for list.sort and sorted, so that the values compared by the min/max routine are produced by applying the key= function to the item under consideration. Note that key= is only a keyword argument and cannot be accessed as a positional argument so as not to interfere with the max(a, b, c, ...) form of the functions.

Logged In: YES user_id=80475

Added various fixups (arg handliing, error handling, ref counts, more tests, docs, news item, and acknowledgement).

Accepted and applied.

See: Python/bltinmodule.c 2.319