Open this example in the interactive library
Source code
from collections import ChainMap
config = ChainMap({'theme':'light'}, {'theme':'dark','size':14})
print(config['theme'], config['size'])Sample output
light 14

Layer configuration with ChainMap. A self-contained example using the Python standard library.
Open this example in the interactive library
from collections import ChainMap
config = ChainMap({'theme':'light'}, {'theme':'dark','size':14})
print(config['theme'], config['size'])light 14