In Slack, @mastrof wanted the equivalent of the following Python 3 code which returns n
items at a time and pads with fillvalue
if there are less than n
items remaining
def f(iterable, n, fillvalue=None):
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue)
We currently do not have zip_longest
in IterTools.jl although there is a PR:
Additionally, the iteration protocol is distinct in Julia from Python.