AI engineering glossary · Python advanced
What is iterator?
Iterator: An object that produces the next item each time next() is called and raises StopIteration when items run out. It remembers its place, so it can be used once, and it makes lazy processing of large data possible.
Iterator: an example
it = iter([10, 20]); next(it) gives 10, next(it) gives 20, and another next(it) raises StopIteration.
Related terms
More Python advanced terms
Where you learn it
Iterator is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.