79430089

Date: 2025-02-11 13:15:39
Score: 1
Natty:
Report link

A collections.ChainMap behaves like a merged dictionary without having to copy over the keys and values. For example:

>>> mydict = {"a": 0}
>>> defaults = {"a": 5, "b": 10}
>>> chain = collections.ChainMap(mydict, defaults)
>>> dict(chain)
{'a': 0, 'b': 10}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Daniel Carpenter