5 ms·
I also find the combination of lambda and defaultdict quite useful: d = defaultdict(lambda: False) or d = defaultdict(lambda: {'foo':set(), 'bar':False})
by bismark 14y 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)
- ralph 14y agoFor the first I do defaultdict(bool) ;-)