npstreams.chunked

npstreams.chunked(iterable, chunksize)

Generator yielding multiple iterables of length ‘chunksize’.

Parameters
  • iterable (iterable) – Iterable to be chunked.

  • chunksize (int) – Chunk size.

Yields

chunk (iterable) – Iterable of size chunksize. In special case of iterable not being divisible by chunksize, the last chunk will be smaller.

:raises TypeError : if chunksize is not an integer.: