dictutils.mergedictΒΆ

dictutils.mergedict(*args, path=None, update=True)[source]ΒΆ

Merge multiple nested mappings into a single dict.

If the first argument is a plain dict, it is updated in-place and returned. If the first argument is None or a non-dict Mapping, a new dict is created.

Parameters:
  • *args – Mappings to merge (first one is modified in-place if possible)

  • path – Internal use for error reporting

  • update (bool) – If True, values in later dicts override earlier ones

Return type:

dict[Any, Any] | None

Returns:

The merged dict (same object as first argument when possible)

Raises:

TypeError – If no arguments provided or arguments are not mappings