zero.stream.Stream.next¶
-
Stream.
next
()[source]¶ Get the next item and increment iteration.
- Returns
The next item.
- Raises
StopIteration – if
loader
is a finite iterator and the data is over- Return type
Any
Examples
stream = Stream(range(3)) assert stream.iteration == 0 assert stream.next() == 0 assert stream.iteration == 1 assert stream.next() == 1 assert stream.next() == 2 assert stream.next() == 0 assert stream.iteration == 4
while True: x = stream.next() ... if stream.iteration % frequency: ...