Vedran Čačić added the comment:
Operator seems OK. After all, we can currently do c+c, which is kinda like c*2
(sequences behave this way generally, and it is a usual convention in
mathematics too). And division by a number is just a multiplication by its
reciprocal. But a dedicated normalize method? No. As Josh said, then you're
forking the API.
The correct way is probably to have a "normalized view" of a Counter. But I
don't know the best way to calculate it fast. I mean, I know it mathematically
(cache the sum of values and update it on every Counter update) but I don't
know whether it's Pythonic enough.
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list