Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44571da

Browse files
committed
Issue 17862: Improve the signature of itertools grouper() recipe.
Putting *n* after the *iterable* matches the signature of other itertools and recipes. Also, it reads better. Suggested by Ezio Melotti.
1 parent 5b1ab24 commit 44571da

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Doc/library/itertools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,9 @@ which incur interpreter overhead.
705705
next(b, None)
706706
return zip(a, b)
707707

708-
def grouper(n, iterable, fillvalue=None):
708+
def grouper(iterable, n, fillvalue=None):
709709
"Collect data into fixed-length chunks or blocks"
710-
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
710+
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
711711
args = [iter(iterable)] * n
712712
return zip_longest(*args, fillvalue=fillvalue)
713713

0 commit comments

Comments
 (0)