New submission from kubat aytekin :
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 i
kubat aytekin added the comment:
I was thinking about use cases where one might want to preserve the original
key. I was not however aware of PEP 455 and the reasons for it's rejection. My
bad.
Yet It is still unclear to me what the best practice would be to reverse lookup
unhas
kubat aytekin added the comment:
Or keep the reverse mapping in another dict:
count = Counter()
reverse_mapping = dict()
for x in all_the_items:
count.update(keyfunc(x))
reverse_mapping[keyfunc(x)] = x
Anyways I'm closing it as it is a partial duplicate o