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
| Name | Type | Description |
|---|---|---|
| m | mapping or None | Optional mapping for the new first layer. |
| kwargs | object | Additional 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"])