[Python-ideas] Support floating-point values in collections.Counter
p.f.moore at gmail.com
Tue Dec 19 06:08:29 EST 2017
On 18 December 2017 at 23:51, Joel Croteau <jcroteau at gmail.com> wrote:
> It would be useful in many scenarios for values in collections.Counter to be
> allowed to be floating point.
Do you have any evidence of this? Code examples that would be
significantly improved by such a change? I can't think of any myself.
I might consider writing
totals - defaultdict(float)
totals[something] = calculation(something)
but using a counter is neither noticeably easier, nor clearer...
One way of demonstrating such a need would be if your proposed
behaviour were available on PyPI and getting used a lot - I'm not
aware of any such module if it is.
More information about the Python-ideas