Call `next(iterator)` to retrieve the next available item. When the iterator is exhausted, `next` raises `StopIteration`. For ordinary iteration, a `for` loop handles exhaustion automatically. section 5.1.1
next(tasks_iterator) # output: 'task0' next(tasks_iterator) # output: 'task1' next(tasks_iterator) # output: 'task2' next(tasks_iterator) # ERROR: StopIteration
Repeated calls retrieve the task items in order; another call after the last item raises `StopIteration`. section 5.1.1
A practical use is consuming a CSV header with `next(csv_reader)`. The subsequent loop then processes the remaining rows. For header-based dictionaries, `csv.DictReader` provides a cleaner alternative. section 11.2.2




