mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Added a noneFill parameter to group.
This commit is contained in:
parent
00290faca9
commit
b299a564ce
@ -233,7 +233,7 @@ def ilen(iterator):
|
||||
i += 1
|
||||
return i
|
||||
|
||||
def group(seq, groupSize):
|
||||
def group(seq, groupSize, noneFill=True):
|
||||
ret = []
|
||||
L = []
|
||||
i = groupSize
|
||||
@ -247,6 +247,9 @@ def group(seq, groupSize):
|
||||
L.append(elt)
|
||||
i -= 1
|
||||
if L:
|
||||
if noneFill:
|
||||
while len(L) < groupSize:
|
||||
L.append(None)
|
||||
ret.append(L)
|
||||
return ret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user