get_else_key

hhpy.main.get_else_key(dct: Mapping[KT, VT_co], key: Any, exclude: Union[Sequence[T_co], int, float, str, bytes, None, AbstractSet[T_co]] = None) → Any[source]

Returns a value from a dictionary if the key is present, if not returns the key

Parameters:
  • dct – dictionary or similar Mapping
  • key – Key of value to attempt get
  • exclude – Keys to not get the value from (always return as is)
Returns:

Value if key in dictionary keys, else key