It would be convenient if a defaultdict could be initialized along the following lines
defaultdict
d = defaultdict(list, ((\'a\', 1), (\'b\', 2), (\'c\', 3), (
>>> kvs = [(1,2), (2,3), (1,3)] >>> reduce( ... lambda d,(k,v): d[k].append(v) or d, ... kvs, ... defaultdict(list)) defaultdict(, {1: [2, 3], 2: [3]})