30 Dec
2011
30 Dec
'11
8:33 p.m.
On 12/30/2011 12:02 PM, Guido van Rossum wrote:
But looking at your code, you are more interested in *elementwise* addition, so that {'x': 1} + {'x': 2} results in {'x': 3}, and missing keys are considered to be zero.
This is part of what collections.Counter does.
(Had I known all this 22 years ago, maybe I could have chosen a different operator for list concatenation.
In base 1 notation, count addition amounts to sequence concatenation. So I think you intuitively made the right choice. -- Terry Jan Reedy