nip.utils.data.forgetful_cycle

nip.utils.data.forgetful_cycle#

nip.utils.data.forgetful_cycle(iterable: Iterable[T]) Iterator[T][source]#

Return an iterator that cycles through an iterable without saving copies.

This iterator will keep yielding items from the iterable in order, and will start over once the iterable is exhausted. However, unlike the itertools.cycle function, it does not save copies of the items in the iterable.

Parameters:

iterable (Iterable) – The iterable to cycle through.

Yields:

item (Any) – The next item in the iterable, cycling through it indefinitely.