summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-27 04:57:51 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-27 04:57:51 (GMT)
commit883d27607ab29afec2e524990a7b860853435074 (patch)
tree2d12353a98a3d0ce7346a0560960cee142de69b0
parent749761e1a8c47665d1f0814d0b85144280003867 (diff)
downloadcpython-883d27607ab29afec2e524990a7b860853435074.zip
cpython-883d27607ab29afec2e524990a7b860853435074.tar.gz
cpython-883d27607ab29afec2e524990a7b860853435074.tar.bz2
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 1470721..618cf7d 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 b1ba8c0..7c858eb 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"