[Python-checkins] r69008 - in python/branches/release30-maint: Doc/library/itertools.rst Lib/test/test_itertools.py
raymond.hettinger
python-checkins at python.org
Tue Jan 27 06:00:57 CET 2009
Author: raymond.hettinger
Date: Tue Jan 27 06:00:57 2009
New Revision: 69008
Log:
Beautify grouper() recipe in docs.
Modified:
python/branches/release30-maint/Doc/library/itertools.rst
python/branches/release30-maint/Lib/test/test_itertools.py
Modified: python/branches/release30-maint/Doc/library/itertools.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/itertools.rst (original)
+++ python/branches/release30-maint/Doc/library/itertools.rst Tue Jan 27 06:00:57 2009
@@ -573,7 +573,7 @@
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"
Modified: python/branches/release30-maint/Lib/test/test_itertools.py
==============================================================================
--- python/branches/release30-maint/Lib/test/test_itertools.py (original)
+++ python/branches/release30-maint/Lib/test/test_itertools.py Tue Jan 27 06:00:57 2009
@@ -1261,7 +1261,7 @@
>>> 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"
More information about the Python-checkins
mailing list