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:
may be a bit slow but works
result = {} for widget_type, app in widgets: result[widget_type] = result.get(widget_type, []) + [app]