3 ms·
Doesn't detract from any of your points, just as a FYI: Python has a counter data structure in the standard library. The "pythonic" way would be something like
by qsort 5y ago
Doesn't detract from any of your points, just as a FYI: Python has a counter data structure in the standard library. The "pythonic" way would be something like this:
groupby_dict = Counter()
for r in response:
groupby_dict.update({r['thing']: r['count']})
Counter is a subclass of dict, no further conversion needed.