Message317007
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 |
|
Date |
User |
Action |
Args |
2018-05-18 07:28:09 | veky | set | recipients:
+ veky, rhettinger, mark.dickinson, pitrou, steven.daprano, serhiy.storchaka, wolma, josh.r, Allen Downey, DavidMertz |
2018-05-18 07:28:09 | veky | set | messageid: <1526628489.32.0.682650639539.issue25478@psf.upfronthosting.co.za> |
2018-05-18 07:28:09 | veky | link | issue25478 messages |
2018-05-18 07:28:09 | veky | create | |
|