ddionrails / testsuite

DDI on Rails - testsuite
0 stars 0 forks source link

defaultdict #8

Closed mhebing closed 8 years ago

mhebing commented 8 years ago

Version 1

a = []
b = []

a.append(1)
b.append(2)

Version 2

x = dict(
    a=[],
    b=[],
)

x["a"].append(1)
x["b"].append(2)

Version 3

from collections import defaultdict
x = defaultdict(list)

x["a"].append(1)
x["b"].append(2)