mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-04 08:34:11 +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
|
i += 1
|
||||||
return i
|
return i
|
||||||
|
|
||||||
def group(seq, groupSize):
|
def group(seq, groupSize, noneFill=True):
|
||||||
ret = []
|
ret = []
|
||||||
L = []
|
L = []
|
||||||
i = groupSize
|
i = groupSize
|
||||||
@ -247,6 +247,9 @@ def group(seq, groupSize):
|
|||||||
L.append(elt)
|
L.append(elt)
|
||||||
i -= 1
|
i -= 1
|
||||||
if L:
|
if L:
|
||||||
|
if noneFill:
|
||||||
|
while len(L) < groupSize:
|
||||||
|
L.append(None)
|
||||||
ret.append(L)
|
ret.append(L)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user