Python 3.11+
pip install interval-tools
Or if you want to use
ObjectId
as a unique identifier for Entity
or Aggregate
, run
pip install "interval-tools[objectid]"
>>> from interval.utils import batched
>>> for batch in batched('ABCDEFG', 3):
... print(batch)
...
('A', 'B', 'C')
('D', 'E', 'F')
('G',)