Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:

The values of a Counter are generally integers, not lists. Maybe you want:

    items_by_keyfunc = defaultdict(list)
    for x in all_the_items:
        items_by_keyfunc[keyfunc(x)].append(x)

Then items_by_keyfunc[42] is a list of the things with key 42.

Although I believe there have been proposals about adding some method to dict() 
to do basically the for-loop above.

----------

_______________________________________
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

Reply via email to