lib5c.util.dictionaries module

Module containing utility functions for working with dicts.

lib5c.util.dictionaries.reduced_get(key, dicts, default=None)[source]

Reduced version of dict.get().

Parameters:
  • key (any) – The key to search for in dicts.
  • dicts (iterable of dicts) – The dicts to search for key. Dicts further right have higher priority.
  • default (any, optional) – The default value if the key is not found in any of the dicts.
Returns:

The value of the key in the furthest-right dict, or default if none of the dicts had the key.

Return type:

any