Can this Python code be shortened and still be readable using itertools and sets?
result = {}
for widget_type, app in widgets:
if widget_type not in result:
result[widget_type] = []
result[widget_type].append(app)
I can think of this only:
widget_types = zip(*widgets)[0]
dict([k, [v for w, v in widgets if w == k]) for k in set(widget_types)])