collections.ChainMap()
collections.ChainMap() is a Python function in the Collections Module category. Combines multiple dicts into a single view. Lookups search each dict in order. The syntax is collections.ChainMap(*maps). Parameters: *maps — dictionary arguments. Returns: ChainMap object. A typical example: from collections import ChainMap
base = {"a":1, "b":2}
ovr = {"a":99}
cm = ChainMap(ovr, base)
cm["a"] # 99 (from ovr)
cm["b"] # 2 (from base). A close sibling is collections.deque(), which returns a double-ended queue (deque) with efficient O(1) appends/pops from both ends. A close sibling is deque.append(), which adds x to the right side of the deque. A close sibling is deque.appendleft(), which adds x to the left side of the deque. A close sibling is deque.pop(), which removes and returns the rightmost element. Raises IndexError if empty. More about this category: Specialized container datatypes — deque, Counter, defaultdict, namedtuple, OrderedDict. For a broader walkthrough, read the Collections Module guide.