I have a counter from the collections
module. What is the best way of summing all of the counts?
For example, I have:
my_counter = Counter({'a': 2, 'b': 2, 'c': 2, 'd': 1})
and would like to get the value 7
returned. As far as I can tell, the function sum
is for adding multiple counters together.