Added a noneFill parameter to group.

This commit is contained in:
Jeremy Fincher 2003-08-17 06:24:58 +00:00
parent 00290faca9
commit b299a564ce
1 changed files with 4 additions and 1 deletions

View File

@ -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