
27 Feb
2019
27 Feb
'19
6:37 p.m.
On Wed, Feb 27, 2019 at 9:34 AM George Castillo gmcastil@gmail.com wrote:
The key conundrum that needs to be solved is what to do for `d1 + d2` when
there are overlapping keys. I propose to make d2 win in this case, which is what happens in `d1.update(d2)` anyways. If you want it the other way, simply write `d2 + d1`.
This would mean that addition, at least in this particular instance, is not a commutative operation. Are there other places in Python where this is the case?
Yes there are. 'a' + 'b' is not the same as 'b' + 'a'.
For non-numbers we only require + to be associative, i.e. a + b + c == (a + b) + c == a + (b + c).
That is satisfied for this proposal.
--
--Guido van Rossum (python.org/~guido)