This commit is contained in:
Lucas Verney 2018-11-07 15:34:52 +01:00
parent 4ef32a5653
commit d87f2ec37d

View File

@ -169,7 +169,10 @@ def batch(iterable, size):
sourceiter = iter(iterable)
while True:
batchiter = itertools.islice(sourceiter, size)
yield itertools.chain([next(batchiter)], batchiter)
try:
yield itertools.chain([next(batchiter)], batchiter)
except StopIteration:
return
def is_within_interval(value, min_value=None, max_value=None):