summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-27 04:57:51 +0000
committerRaymond Hettinger <python@rcn.com>2009-01-27 04:57:51 +0000
commitc3138ffe998e3ce854cf2b3c024ba087b1ed6478 (patch)
treea4927977a40d37951b3bcd1a3baefe3905a5a6f5
parent93e5bc9be765abd22ff206a069ae57b80f995a4a (diff)
downloadcpython-c3138ffe998e3ce854cf2b3c024ba087b1ed6478.tar.gz
Beautify grouper() recipe in docs.
-rw-r--r--Doc/library/itertools.rst2
-rw-r--r--Lib/test/test_itertools.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 1470721465..618cf7da47 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -634,7 +634,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 b1ba8c025c..7c858eb97e 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1370,7 +1370,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"