This commit is contained in:
Raymond Hettinger 2013-05-05 19:54:04 -07:00
commit 77371a5eea
1 changed files with 2 additions and 2 deletions

View File

@ -705,9 +705,9 @@ which incur interpreter overhead.
next(b, None)
return zip(a, b)
def grouper(n, iterable, fillvalue=None):
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue)