diff options
author | Raymond Hettinger <python@rcn.com> | 2013-05-06 02:45:42 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2013-05-06 02:45:42 (GMT) |
commit | 277c27c8fce8e58ed22f5aa25627785fb08e4ce4 (patch) | |
tree | 59589edf11e2950d136a5dcaf91ff2c89f10a1d3 /Doc/library/itertools.rst | |
parent | 6a4f39416580b4e4f0f39aca31ad2f5ef149f603 (diff) | |
download | cpython-277c27c8fce8e58ed22f5aa25627785fb08e4ce4.zip cpython-277c27c8fce8e58ed22f5aa25627785fb08e4ce4.tar.gz cpython-277c27c8fce8e58ed22f5aa25627785fb08e4ce4.tar.bz2 |
Issue 17862: Improve the signature of itertools grouper() recipe.
Putting *n* after the *iterable* matches the signature of other itertools
and recipes. Also, it reads better.
Suggested by Ezio Melotti.
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r-- | Doc/library/itertools.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 0e98c1e..7645281 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -732,9 +732,9 @@ which incur interpreter overhead. next(b, None) return izip(a, b) - def grouper(n, iterable, fillvalue=None): + def grouper(iterable, n, fillvalue=None): "Collect data into fixed-length chunks or blocks" - # grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx + # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx args = [iter(iterable)] * n return izip_longest(fillvalue=fillvalue, *args) |