Since Python 3.9 dicts support | and |=. I like it for the classic pattern of default settings plus whatever the user changed.
defaults = {"host": "127.0.0.1", "port": 8080, "debug": False}
overrides = {"port": 9000}
settings = defaults | overrides
print(settings) # {'host': '127.0.0.1', 'port': 9000, 'debug': False}
settings |= {"debug": True} # update in place
The right side wins when a key exists on both sides. a | b builds a new dict and leaves both originals alone, while a |= b changes a in place, just like a.update(b).
It reads more clearly to me than {**defaults, **overrides}, and you can chain several layers: defaults | file_config | env_config, where each later one wins.
The merge is shallow, and that’s the thing to watch with config. If defaults has a nested "db": {...} section and the override has only {"db": {"port": 5433}}, the whole db dict gets replaced and you lose the host and user that were in the default. For nested config you need a small recursive merge function, or keep the config flat.
Further reading: dict union operators, PEP 584
Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more