[issue30196] Add __matmul__ to collections.Counter

Raymond Hettinger report at bugs.python.org
Fri Apr 28 16:11:48 EDT 2017


Raymond Hettinger added the comment:

Periodically, I've looked at possibly adding these kind of extensions. 

The argument in favor in that it is easy to do and is an obvious extension with plausible utility.  

The main arguments against is that it represents feature creep far removed from the original intended use cases (the tool is primary about counting and trys not to venture into elementwise arithmetic on sparse vectors.)   

It is tempting to add a new feature that might sometimes be useful, but we should also worry that usability and learnability are impaired if the class becomes less cohesive, less thematic, and less focused on unified design goals.

The other factor against adding the feature is that since the Counter is just a dict subclass, it is easy for users to just manipulate the data directly.  We're not really adding much that a person can't already easily do themselves.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30196>
_______________________________________


More information about the Python-bugs-list mailing list