Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Steven Bethard] > > For Python 2.5, I'd like to add a keyword argument 'key' to min and > > max like we have now for list.sort and sorted. > . . . > > This means that a 'key' > > argument can *only* be specified as a keyword parameter, thus giving > > us the asymmetry we see in these examples. > > FWIW, in Py2.5 I plan on adding a key= argument to heapq.nsmallest() and > heapq.nlargest(). There is no "assymmetry" issue with those functions, > so it can be implemented cleanly. And, since min/max are essentially > the same nsmallest/nlargest with n==1, your use case is covered and > there is no need to mess with the min/max builtins.
I don't want to put words into your mouth, so is this a vote against a key= argument for min and max? If nsmallest/nlargest get key= arguments, this would definitely cover the same cases. If a key= argument gets vetoed for min and max, I'd at least like to add a bit of documentation pointing users of min/max to nsmallest/nlargest if they want a key= argument... Steve -- You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy _______________________________________________ Python-Dev mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com