Vedran Čačić <ved...@gmail.com> added the comment:

Well, yes, floats are innacurate. Do you really expect to normalize Counters 
containing values like a googol, or was it just a strawman? For me, it is much 
more imaginable* that total be zero because you have a negative value (e.g. 
{'spam': -1, 'eggs': 1}) than because you had a googol in your Counter at some 
time in the past.

(*) Note that the documentation says

> Counts are allowed to be any integer value including zero or _negative_ 
> counts. (emphasis mine)

... and floats are only mentioned at the bottom, in a Note. Besides, floats 
have that problem already, even with an existing API:

>>> from collections import Counter as C
>>> big = C(spam=1e100)
>>> c = C(spam=1)
>>> not +c
False
>>> c.update(big)
>>> c.subtract(big)
>>> not +c
True

----------

_______________________________________
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