Skip to main content

One doc tagged with "yield"

View all tags

Generators: Creating Iterators with `yield`

In the last article, we learned how to create a custom iterator by building a class that implements the full iterator protocol (iter and next). While this is powerful, it's also quite verbose for many common use cases.