Skip to main content

2 docs tagged with "generators"

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.