Counter Class -- Bag/Multiset
benjamin.kaplan at case.edu
Fri Jan 23 03:20:33 CET 2009
> Hi Raymond,
> * I'm not a native speaker, but why use the word "Counter"? A "counter"
> to my ear sounds like a number that is increased each time an event
> occurs; the website counter, eg, comes to mind. I can understanda its
> meaning probably stretches to "an object that counts", but I really can't
> think of it as a group of object, or a container of object. Moreover, I
> find it a much more useful abstraction the idea of a "multi-set" (that
> is, a set where elements can appear with multiple cardinality), rather
> than stressing the concept of "counting" how many times each element
> appears in the set.
> * I find it *very* confusing c.items() vs c.elements(). Items and
> elements are synonymous (again, in my understanding of English).
> All in all, I think I prefer your previous bag class:
Well, I am a native English speaker and I agree with your points completely.
Also, wouldn't it be better to either have a least_common method or allow
most_common to take a negative integer rather than having to use
most_common()[:-n:-1]? For a large Counter, this could take up a lot of
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list