Author DavidMertz
Recipients DavidMertz, josh.r, mark.dickinson, pitrou, rhettinger, veky, wolma
Date 2017-03-14.16:17:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489508266.54.0.352672594197.issue25478@psf.upfronthosting.co.za>
In-reply-to
Content
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?")
History
Date User Action Args
2017-03-14 16:17:46DavidMertzsetrecipients: + DavidMertz, rhettinger, mark.dickinson, pitrou, wolma, josh.r, veky
2017-03-14 16:17:46DavidMertzsetmessageid: <1489508266.54.0.352672594197.issue25478@psf.upfronthosting.co.za>
2017-03-14 16:17:46DavidMertzlinkissue25478 messages
2017-03-14 16:17:46DavidMertzcreate