merge_dicts (or |)¶
Info
New in Atfinity 17.
Description¶
merge_dicts merges any number of dictionaries into a single dictionary.
It is variadic, so you can pass two, three, or more dictionaries.
For merging exactly two dictionaries, the infix | operator can be used as a shorter alternative.
When the same key appears in more than one dictionary, the value from the later argument (or, for |, the
right-hand side) wins.
This matches the semantics of Python's dict | dict operator.
Examples¶
Later values overwrite earlier ones on overlap:
Using the infix | operator: