Raymond Hettinger added the comment:

There is a bit an inconsistency but it is more helpful than harmful most of the 
time.  The glossary defines a key-function which is used in a number of places 
such such as sorted(), min(), nsmallest() and others.  In all those cases, the 
parameter for the key-function is *key*.

It might feel "more consistent" to call it "key" everywhere, but that leaves 
out the explanation that *key* represents a key-function.

The other issue is that groupby() returns a (key, sub-iterator) pair where 
"key" is the result of key-function, not the key itself.

What we have now is imperfect but it does a reasonably good job helping people 
understand what the function does.  IMO, changing it to be "key" would make the 
docs less intelligible.

Thank you for the patch, but I'm going to pass on it.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21771>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to