[Python-ideas] [Python-Dev] hello, new dict addition for new eve ?

Terry Reedy tjreedy at udel.edu
Fri Dec 30 21:33:43 CET 2011


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




More information about the Python-ideas mailing list