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@python components: Documentation files: groupby-keyfunc.patch keywords: patch messages: 220639 nosy: docs@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 <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