Collection Methods

collections.ChainMap.new_child()

Return a new chain with a supplied mapping or a fresh dictionary at the front. Additional keywords update that new mapping; existing layers remain shared.

Formal Syntax & Structure

python syntaxpython
chain.new_child(m=None, **kwargs)

Parameters & Attributes

NameTypeDescription
mmapping or NoneOptional mapping for the new first layer.
kwargsobjectAdditional keyword entries or arguments.

Return Value

ChainMap

The ChainMap result described above.

Working Example

Example Snippetpython
import collectionsc=collections.ChainMap({"x":1})print(c.new_child({"x":2})["x"])
Python Reference