In the previous chapters, we worked with single variables. It is not hard to see the limitations of this approach—many tasks involve repetitive processes and rich data structures. In fact, the actual number of values can often vary, so our code should be able to work with values in bulk. Of course, Python has a handful of built-in data structures to meet those requirements!
In this chapter, we will discuss the most popular data structures and each of their APIs, benefits, and shortcomings. Data structures are essential to programming skills, as they are required for most tasks and their behaviors. The pros and cons of each specific type of structure are deeply rooted in their underlying mechanisms, which significantly affect the performance of their code. Understanding data structures allows us to write shorter and more expressive code.
In this chapter,...