[Python-checkins] r65321 - in python/trunk: Doc/library/itertools.rst Lib/test/test_itertools.py
raymond.hettinger
python-checkins at python.org
Thu Jul 31 03:19:50 CEST 2008
Author: raymond.hettinger
Date: Thu Jul 31 03:19:50 2008
New Revision: 65321
Log:
Alter recipe to show how to call izip_longest() with
both a keyword argument and star arguments.
Modified:
python/trunk/Doc/library/itertools.rst
python/trunk/Lib/test/test_itertools.py
Modified: python/trunk/Doc/library/itertools.rst
==============================================================================
--- python/trunk/Doc/library/itertools.rst (original)
+++ python/trunk/Doc/library/itertools.rst Thu Jul 31 03:19:50 2008
@@ -647,8 +647,7 @@
def grouper(n, iterable, fillvalue=None):
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
- kwds = dict(fillvalue=fillvalue)
- return izip_longest(*args, **kwds)
+ return izip_longest(fillvalue=fillvalue, *args)
def roundrobin(*iterables):
"roundrobin('ABC', 'D', 'EF') --> A D E B F C"
Modified: python/trunk/Lib/test/test_itertools.py
==============================================================================
--- python/trunk/Lib/test/test_itertools.py (original)
+++ python/trunk/Lib/test/test_itertools.py Thu Jul 31 03:19:50 2008
@@ -1236,8 +1236,7 @@
>>> def grouper(n, iterable, fillvalue=None):
... "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
... args = [iter(iterable)] * n
-... kwds = dict(fillvalue=fillvalue)
-... return izip_longest(*args, **kwds)
+... return izip_longest(fillvalue=fillvalue, *args)
>>> def roundrobin(*iterables):
... "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
More information about the Python-checkins
mailing list