[docs] [issue21771] name of 2nd parameter to itertools.groupby()
report at bugs.python.org
Sun Jun 15 23:26:02 CEST 2014
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 <report at bugs.python.org>
More information about the docs