How Iterators Work Internally
摘要
Iterators are widely used in Python. They let us traverse various “containers” without having to use a conventional for loop, as is common in other programming languages. These so-called containers are not limited to lists—dictionaries, strings, and ranges can all be iterated over in a similar way. In this chapter, we’ll explore how iterators are implemented.