def slices1d(n, k, keepdims=False):
    if k == 1 and not keepdims:
        return list(range(n))
    return [slice(k*i, min(k*(i + 1), n)) for i in range(int(ceil(float(n)/k)))]
>>> slices1d(10, 5)
dataset/ETHPy150Open blaze/blaze/blaze/partition.py/slices1d