On Tue, Dec 19, 2017 at 12:51 AM, Joel Croteau <jcroteau@gmail.com> wrote:
It would be useful in many scenarios for values in collections.Counter to be allowed to be floating point. I know that Counter nominally emulates a multiset, which would suggest only integer values, but in a more general sense, it could be an accumulator of either floating point or integer data. As near as I can tell, Collection already does support float values in both Python 2.7 and 3.6, and the way the code is implemented, this change should be a no-op. All that is required is to update the documentation to say floating-point values are allowed, as it currently says only integers are allowed.
How should the `elements` method work? Currently it raises TypeError: integer argument expected, got float At least it should be documented that the method only works when all counts are integers. The error message could also state exactly what key it failed on.