[Python-ideas] Adding a `Counter.elements_length` method

Raymond Hettinger raymond.hettinger at gmail.com
Thu Mar 31 23:37:04 CEST 2011


On Mar 31, 2011, at 2:28 PM, cool-RR wrote:

> I suggest a `Counter.elements_length` method should be added, that would give the same answer as `sum(counter.itervalues())`. What do you think?

Please open a feature request on the bug tracker and assign it to me.
For the time being, I'm reluctant to further fatten the API, but this
isn't an unreasonable request and there is precedent with
Smalltalk's Bag API.  On the other hand, sum(c.values()) is
somewhat trivial.


Raymond




More information about the Python-ideas mailing list