class_docstr: OVERVIEW
  
      tuple with support for dict-like __getitem__(key)
  
          dict_tuple = DictTuple({"x": 1, "y": 2})
  
          dict_tuple["x"] == 1
  
          dict_tuple["y"] == 2
  
          dict_tuple[0] == 1
  
          dict_tuple[1] == 2
  
      everything else, e.g. __contains__, __iter__, behaves similarly to a tuple
  
  
  CREATION
  
      DictTuple(iterable) -> DictTuple([("x", 1), ("y", 2)])
  
      DictTuple(mapping) -> DictTuple({"x": 1, "y": 2})
  
      DictTuple(values, keys) -> DictTuple([1, 2], ["x", "y"])
  
  
  IMPLEMENTATION DETAILS
  
      DictTuple[_KT, _VT] is essentially a tuple[_VT, ...] that maintains an immutable Mapping[_KT, int]
      from the key to the tuple index internally.
  
      For example DictTuple({"x": 12, "y": 34}) is just a tuple (12, 34) with a {"x": 0, "y": 1} mapping.
  
      types.MappingProxyType is used for the mapping for immutability.
code: def __init__(self, __value=None, /):
      if isinstance(__value, MappingProxyType):
          self.__mapping = __value
      elif isinstance(__value, Mapping):
          self.__mapping = MappingProxyType(__value)
      elif isinstance(__value, Iterable):
          self.__mapping = MappingProxyType(
              OrderedDict((k, i) for i, k in enumerate(__value))
          )
      elif isinstance(__value, Callable):
          self.__mapping = MappingProxyType(
              OrderedDict((__value(v), i) for i, v in enumerate(self))
          )
  
      super().__init__()
  
      if len(self.__mapping) != len(self):
          raise ValueError(
              "`__keys` and `__values` do not have the same length"
          )
  
      if any(
          isinstance(k, SupportsIndex) for k in self.__mapping.keys()
      ):
          raise ValueError(
              "values of `__keys` should not have type `int`, "
              "or implement `__index__()`"
          )
  
imports: from collections import OrderedDict
  from collections import deque
  from collections.abc import Collection
  from collections.abc import Iterable
  from collections.abc import KeysView
  from collections.abc import Mapping
  from types import MappingProxyType
  from typing import Callable
  from typing import Generic
  from typing import Optional
  from typing import SupportsIndex
  from typing import TypeVar
  from typing import Union
  from typing import overload
  from typing_extensions import Self
label_desc: Use image node_id 6 to create a new DictTuple object from inherited base classes: tuple, Generic with example: obj = DictTuple()