From d1c417e9369dfcdcf83d7ff5a58ec6354bad19fb Mon Sep 17 00:00:00 2001 From: Ky-Anh Huynh <75696+icy@users.noreply.github.com> Date: Thu, 18 Jan 2024 06:20:15 +0000 Subject: [PATCH] minor: small doc improvement (#29) --- docs/guide.rst | 4 +++- docs/index.rst | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/guide.rst b/docs/guide.rst index b7ec2ef..8145e1c 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -9,7 +9,7 @@ through common data structures and joining results. Although it's recommended to choose your own strategies, deepmerge does provided some preconfigured mergers for a common situations: -* deepmerge.always_merger: always try to merge. in the case of mismatches, the value from the second object overrides the first o ne. +* deepmerge.always_merger: always try to merge. in the case of mismatches, the value from the second object overrides the first one. * deepmerge.merge_or_raise: try to merge, raise an exception if an unmergable situation is encountered. * deepmerge.conservative_merger: similar to always_merger, but in the case of a conflict, use the existing value. @@ -43,6 +43,8 @@ This is intentional, as an implicit copy would result in a significant performan result = deepcopy(base) always_merger.merge(result, next) + assert id(result) != id(base) + Authoring your own Mergers ========================== diff --git a/docs/index.rst b/docs/index.rst index 0e542e8..6ba155b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -34,6 +34,8 @@ Example assert expected_result == result + # The merge action will change the first dict (base). + assert id(base) == id(result) **Custom Strategy**