Mark Dickinson <dicki...@gmail.com> added the comment:

The point is that if you cache the total and update on each operation, you end 
up with a total that depends not just on the current contents of the Counter, 
but also on the history of operations. That seems like a bad idea: you could 
have two Counters with exactly the same counts in them (so that they compare 
equal), but with different cached totals.

So if floats (or Decimal instances) are permitted as Counter values, your 
suggested caching approach is not viable.

Of course, if Counter values are restricted to be plain old integers then it's 
fine, but that's not the current state of affairs.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue25478>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to