We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1b6628c + bff978b commit 473f3eeCopy full SHA for 473f3ee
1 file changed
examples/04_operators/operators_dict.py
@@ -1,3 +1,10 @@
1
+# Merging and updating dictionaries
2
+# -----------------------------------------------------------------------------
3
+# Python 3.9 introduced the | and |= operators to combine dictionaries. The |
4
+# operator creates a new dictionary containing keys from both operands, while
5
+# |= updates the dictionary on the left in place. This provides a concise
6
+# alternative to using the update() method or ** unpacking for merging.
7
+
8
a = {'a': 1, 'b': 2, 'c': 3}
9
b = {'d': 4, 'e': 5}
10
0 commit comments