イテラブルの要素を数個ずつに分けて取り出したい
#more-itertools
ichunked
Break iterable into lists of approximately length n.
https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.ichunked
大雑把に言うと、n=1のときが
itertools.islice
https://stackoverflow.com/a/57247000
で知った
chunkedもある
batchedでもできる?
https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.batched
Python3.12から
itertoolsに入った
https://docs.python.org/ja/3/library/itertools.html#itertools.batched