Real-world use of Counter
Rustom Mody
rustompmody at gmail.com
Thu Nov 6 01:00:48 EST 2014
On Wednesday, November 5, 2014 9:57:08 PM UTC+5:30, Ethan Furman wrote:
> In order to avoid unnecessary code churn (the fix itself is quite simple), the maintainer of the collections module
> wants to know if anybody has actually been affected by these inconsistencies, and if so, whether it was a minor
> inconvenience, or a compelling use-case.
>
> So, if this has bitten you, now is the time to speak up! :)
Not in direct answer to your specific question, but Counter generally.
In studying (somewhat theoretically) the general world of
collection data structures we see
- sets -- neither order nor repetition
- bags -- no order, repetition significant
- lists -- both order and repetition
Sometimes 'bag' is called 'multiset'
However counter is a weird non-standard name that overloads
an already overloaded term -- 'Counter' has a very standard meaning in programming and in hardware design.
Yes changing the name is too code-churn causing.
But a synonym Bag (or multiset) for Counter would be a pleasant
addition for me.
Calling a bag as counter is inappropriate for an analogous reason
to why calling a dictionary as a 'hash' is inappropriate --
it confuses an implementation detail for fundamental semantics.
--------
PS. I probably wont participate in this discussion hereafter because off-net for 2 weeks
More information about the Python-list
mailing list