10.5 Recall
This chapter looked at a design pattern that seems ubiquitous in Python, the iterator. The Python iterator concept is the foundation of the language and is used widely. In this chapter, we examined a number of aspects:
-
Design patterns are good ideas that we see repeated in software implementations, designs, and architectures. A good design pattern has a name, and a context where it’s usable. Because it’s only a pattern, not reusable code, the implementation details will vary each time the pattern is followed.
-
The Iterator protocol is one of the most powerful design patterns because it provides a consistent way to work with data collections. We can view strings, tuples, lists, sets, and even files as iterable collections. A mapping contains a number of iterable collections, including the keys, the values, and the items (key and value pairs).
-
List, set, and dictionary...