From: Raymond Hettinger Date: Tue, 27 Jan 2009 05:00:57 +0000 (+0000) Subject: Beautify grouper() recipe in docs. X-Git-Tag: v3.0.1~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06dc0f5b77554064d5aa4e9b24318e856740c5f1;p=thirdparty%2FPython%2Fcpython.git Beautify grouper() recipe in docs. --- diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index ba6ab1c32745..f0bb251602ef 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -573,7 +573,7 @@ which incur interpreter overhead. def grouper(n, iterable, fillvalue=None): "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" args = [iter(iterable)] * n - return zip_longest(fillvalue=fillvalue, *args) + return zip_longest(*args, fillvalue=fillvalue) def roundrobin(*iterables): "roundrobin('ABC', 'D', 'EF') --> A D E B F C" diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 7023b293bf04..a675052cd875 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -1261,7 +1261,7 @@ Samuele >>> def grouper(n, iterable, fillvalue=None): ... "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" ... args = [iter(iterable)] * n -... return zip_longest(fillvalue=fillvalue, *args) +... return zip_longest(*args, fillvalue=fillvalue) >>> def roundrobin(*iterables): ... "roundrobin('ABC', 'D', 'EF') --> A D E B F C"