Preface Part I. Data Structures 1. The Python Data Model What's New in This Chapter A Pythonic Card Deck How Special Methods Are Used Emulating Numeric Types String Representation Boolean Value of a Custom Type Collection API Overview of Special Methods Why len Is Not a Method Chapter Summary Further Reading 2. An Array of Sequences What's New in This Chapter Overview of Built-In Sequences List Comprehensions and Generator Expressions List Comprehensions and Readability Listcomps Versus map and filter Cartesian Products Generator Expressions Tuples Are Not lust Immutable Lists Tuples as Records Tuples as Immutable Lists Comparing Tuple and List Methods Unpacking Sequences and Iterables Using * to Grab Excess Items Unpacking with in Function Calls and Sequence Literals Nested Unpacking Pattern Matching with Sequences Pattern Matching Sequences in an Interpreter Slicing Why Slices and Ranges Exclude the Last Item Slice Objects Multidimensional Slicing and Ellipsis Assigning to Slices Using + and * with Sequences Building Lists of Lists Augmented Assignment with Sequences A += Assignment Puzzler list.sort Versus the sorted Built-In When a List Is Not the Answer Arrays Memory Views NumPy Deques and Other eues Chapter Summary Further Reading 3. Dictionaries and Sets