Why doesn't the + symbol work?
Given
a = {1: 1}
b = {2: 2}
This c = {**a, **b}
is equivalent to c = {1: 1, 2: 2} {1,2}|{2,3} == {1,2,3}
I guess the reason they went for the weird {∗∗a, ∗∗b} syntax is that it is not a commutative operation. >>> s1 = {'a', 'b', 'c'}
>>> s2 = {1, 2, 3}
>>> {*s1, *s2}
{'b', 1, 2, 3, 'c', 'a'}
>>> l1 = ['a', 'b', 'c']
>>> l2 = [1, 2, 3]
>>> [*l1, *l2]
['a', 'b', 'c', 1, 2, 3]