[docs] [issue21771] name of 2nd parameter to itertools.groupby()

Uwe Kleine-König report at bugs.python.org
Sun Jun 15 16:07:16 CEST 2014


New submission from Uwe Kleine-König:

The name of the 2nd parameter to itertools.groupby() is documented inconsitently. Sometimes it's "key", sometimes "keyfunc". The code actually uses "key", so I adapted all occurences I found to "key".

>>> from itertools import groupby
>>> groupby.__doc__
'groupby(iterable[, keyfunc]) -> create an iterator which returns\n(key, sub-iterator) grouped by each value of key(value).\n'

>>> groupby([], keyfunc=lambda x: x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'keyfunc' is an invalid keyword argument for this function

>>> groupby([], key=lambda x: x)
<itertools.groupby object at 0x7fee025d2048>

----------
assignee: docs at python
components: Documentation
files: groupby-keyfunc.patch
keywords: patch
messages: 220639
nosy: docs at python, ukl
priority: normal
severity: normal
status: open
title: name of 2nd parameter to itertools.groupby()
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35645/groupby-keyfunc.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21771>
_______________________________________


More information about the docs mailing list