fork download
  1. import collections
  2. d = collections.defaultdict(int)
  3. d['a'] = 2
  4. d['b'] = 1
  5. res = [d.copy() for _ in range(2)]
  6. res[0]['a'] -= 1
  7. print res[1]
Success #stdin #stdout 0s 23688KB
stdin
Standard input is empty
stdout
defaultdict(<type 'int'>, {'a': 2, 'b': 1})