Hacker News new | ask | show | jobs
by bismark 4908 days ago
I also find the combination of lambda and defaultdict quite useful:

  d = defaultdict(lambda: False)
or

  d = defaultdict(lambda: {'foo':set(), 'bar':False})
  d['baz']['foo'].add(1)
1 comments

For the first I do defaultdict(bool) ;-)