5 Built-In Data Structures Part 2: Dictionaries

Starting with Chapter 4, Built-In Data Structures Part 1: Lists and Sets, we began looking at Python’s rich collection of built-in data structures. These data structures are sometimes called ”containers” or ”collections” because they contain a collection of individual items.

In this chapter, we’ll cover the dictionary structure. A dictionary is a mapping from keys to values, sometimes called an associative array. It seems sensible to separate mappings from the two sequences – lists and sets.

This chapter will also look at some more advanced topics related to how Python handles references to mutable collection objects. This has consequences in the way functions need to be defined.

In this chapter, ...

Get Modern Python Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.