Beautify grouper() recipe in docs.
This commit is contained in:
parent
749761e1a8
commit
883d27607a
|
@ -634,7 +634,7 @@ which incur interpreter overhead.
|
|||
def grouper(n, iterable, fillvalue=None):
|
||||
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
|
||||
args = [iter(iterable)] * n
|
||||
return zip_longest(fillvalue=fillvalue, *args)
|
||||
return zip_longest(*args, fillvalue=fillvalue)
|
||||
|
||||
def roundrobin(*iterables):
|
||||
"roundrobin('ABC', 'D', 'EF') --> A D E B F C"
|
||||
|
|
|
@ -1370,7 +1370,7 @@ Samuele
|
|||
>>> def grouper(n, iterable, fillvalue=None):
|
||||
... "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
|
||||
... args = [iter(iterable)] * n
|
||||
... return zip_longest(fillvalue=fillvalue, *args)
|
||||
... return zip_longest(*args, fillvalue=fillvalue)
|
||||
|
||||
>>> def roundrobin(*iterables):
|
||||
... "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
|
||||
|
|
Loading…
Reference in New Issue