Message289600
I definitely wouldn't want a mutator that "normalized" counts for the reason Antoine mentions. It would be a common error to normalize then continue meaningless counting.
One could write a `Frequency` subclass easily enough. The essential feature in my mind would be to keep an attribute `Counter.total` around to perform the normalization. I'm +1 on adding that to `collections.Counter` itself.
I'm not sure if this would be better as an attribute kept directly or as a property that called `sum(self.values())` when accessed. I believe that having `mycounter.total` would provide the right normalization in a clean API, and also expose easy access to other questions one would naturally ask (e.g. "How many observations were made?") |
|
Date |
User |
Action |
Args |
2017-03-14 16:17:46 | DavidMertz | set | recipients:
+ DavidMertz, rhettinger, mark.dickinson, pitrou, wolma, josh.r, veky |
2017-03-14 16:17:46 | DavidMertz | set | messageid: <1489508266.54.0.352672594197.issue25478@psf.upfronthosting.co.za> |
2017-03-14 16:17:46 | DavidMertz | link | issue25478 messages |
2017-03-14 16:17:46 | DavidMertz | create | |
|