New submission from kubat aytekin <kubatayte...@yahoo.com.tr>:
Counter has become the default tool for counting occurences of objects in an iterable. However by construction it only works on hashable objects as it is a subclass of dict. Would it be possible to implement a "key=" keyword argument as in sort etc.? Here's a stackoverflow question wherein either map or implementing a hash method was proposed: https://stackoverflow.com/questions/69401713/elegant-way-of-counting-items-in-a-list-by-enum-value-in-python ---------- components: Library (Lib) messages: 403002 nosy: kubataytekin priority: normal severity: normal status: open title: Add key argument to collections.Counter type: enhancement versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45338> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com