chainmaps the collections chainmap class was added in python and it provides way to link number of dictionariesor other mappingsso that they can be treated as one object in additionthere is maps attributea new_child(methodand parents property the underlying mappings for chainmap objects are stored in list and are accessible using the maps[iattribute to retrieve the ith dictionary note that even though dictionaries themselves are unorderedchainmaps are an ordered list of dictionaries chainmap is useful in applications where we are using number of dictionaries containing related data the consuming application expects data in terms of prioritywhere the same key in two dictionaries is given priority if it occurs at the beginning of the underlying list chainmap is typically used to simulate nested contexts such as when we have multiple overriding configuration settings the following example demonstrates possible use case for chainmapthe advantage of using chainmapsrather than just dictionaryis that we retain previously set values adding child context overrides values for the same keybut it does not remove it from the data structure this can be useful for when we may need to keep record of changes so that we can easily roll back to previous setting we can retrieve and change any value in any of the dictionaries by providing the map(method with an appropriate index this index represents dictionary in the chainmap alsowe can retrieve the parent settingthat isthe default settingsby using the parents(method