ENH: Implemented lazy iteration
Fixes GH20783.

- [x] closes #20783
- [x] no tests needed because just internal implementation change
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
     * there are some failures on existing code
- [x] whatsnew entry
