Author veky
Recipients Allen Downey, DavidMertz, josh.r, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, steven.daprano, veky, wolma
Date 2018-05-18.07:28:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526628489.32.0.682650639539.issue25478@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-05-18 07:28:09vekysetrecipients: + veky, rhettinger, mark.dickinson, pitrou, steven.daprano, serhiy.storchaka, wolma, josh.r, Allen Downey, DavidMertz
2018-05-18 07:28:09vekysetmessageid: <1526628489.32.0.682650639539.issue25478@psf.upfronthosting.co.za>
2018-05-18 07:28:09vekylinkissue25478 messages
2018-05-18 07:28:09vekycreate