On this page
  1. typing.ChainMap
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

typing.ChainMap

Prev: typing.cast | Up: typing | Next: typing.ClassVar
Rel: typing.AbstractSet, typing.Annotated, typing.Any, typing.assert_never
Ref: docs.python.org — typing.ChainMap
Tags: #public #python3 #stdlib #typing


Import

import typing
from typing import ChainMap

Signature & Overview

typing.ChainMap(*args, **kwargs)

Deprecated alias to collections.ChainMap.

Usage

from collections import ChainMap as _CM
from typing import ChainMap

cfg: ChainMap[str, int] = _CM({"a": 1}, {"b": 2})
assert cfg["b"] == 2

Gotchas

REPL Inspect

from typing import ChainMap
help(ChainMap)

Linked from

Related notes