Kaydet (Commit) f080e6d7 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Alter recipe to show how to call izip_longest() with

both a keyword argument and star arguments.
üst 246daedd
......@@ -647,8 +647,7 @@ which incur interpreter overhead.
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"
......
......@@ -1236,8 +1236,7 @@ Samuele
>>> 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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment