5.1 Creating dictionaries – inserting and updating
A dictionary is one kind of Python mapping. The built-in type dict provides a number of foundational features. There are some common variations on these features defined in the collections module.
As we noted in the Choosing a data structure recipe at the beginning of Chapter 4, we’ll use a dictionary when we have a key that we need to map the key to a given value. For example, we might want to map a single word to a long, complex definition of the word, or perhaps map some value to a count of the number of times that value has occurred in a dataset.
5.1.1 Getting ready
We’ll look at an algorithm for locating the various stages in transaction processing. This relies on assigning a unique ID to each request and including that ID with each log record written during the transaction. Because a multi-threaded server may be handling a number of requests concurrently,...