Fix-up recipe with a syntax error (as discussed on python-dev).

This commit is contained in:
Raymond Hettinger 2008-07-30 07:45:01 +00:00
parent f5a2e47ad3
commit 2e73ffcf7b
1 changed files with 2 additions and 1 deletions

View File

@ -565,7 +565,8 @@ which incur interpreter overhead.
def grouper(n, iterable, fillvalue=None): def grouper(n, iterable, fillvalue=None):
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue) kwds = dict(fillvalue=fillvalue)
return zip_longest(*args, **kwds)
def roundrobin(*iterables): def roundrobin(*iterables):
"roundrobin('ABC', 'D', 'EF') --> A D E B F C" "roundrobin('ABC', 'D', 'EF') --> A D E B F C"