# Iterator

say it: **“IT-uh-ray-ter”** **/ˈɪtəreɪtər/**

Gives out items one at a time with next() and remembers where it is.

## What is an **iterator**?

An **iterator** gives out items one at a time with `next()` and remembers where it is. A `for` loop uses one behind the scenes.

```python
line = iter(["Ana", "Ben", "Cai"])
print(next(line))  # Ana
print(next(line))  # Ben
```

Level: Freelancer · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=4)

Updated: November 17, 2026

## In other subjects

- [Iterator in C#](https://www.ask-codey.com/glossary/iterator-c-sharp)
- [Iterator in Java](https://www.ask-codey.com/glossary/iterator-java)
- [Iterator in JavaScript](https://www.ask-codey.com/glossary/iterator-javascript)

Source: https://www.ask-codey.com/glossary/iterator
