keyword argument for min/max
steven.bethard at gmail.com
Tue Nov 30 19:02:25 CET 2004
Steven Bethard wrote:
> So I've been playing around with trying to add a keyword argument to min
> and max that works similarly to the one for sorted. It wasn't too hard
> actually, but it does raise a few questions about proper handling of
> keyword arguments.
Sorry to reply to my own post, but I thought of another question about
adding this feature. Should the following work?
.>>> max((2, 'a'), (1, 'b'), key=operator.itemgetter(1))
That is, should you be able to specify a 'key' argument as a keyword
parameter after a list of positional arguments (to be min/maxed).
More information about the Python-list