colour.utilities.batch#

colour.utilities.batch(sequence: Sequence, k: Union[Integer, Literal[3]] = 3) Generator[source]#

Return a batch generator from given sequence.

Parameters
  • sequence (Sequence) – Sequence to create batches from.

  • k (Union[Integer, Literal[3]]) – Batch size.

Yields

Generator – Batch generator.

Return type

Generator

Examples

>>> batch(tuple(range(10)), 3)  
<generator object batch at 0x...>