3 ms·
This is actually quite elegant and useful. I've done similar things time and time again with code like so: defaultdict(lambda: defaultdict(int)) That allo
by bryanh 14y ago
This is actually quite elegant and useful. I've done similar things time and time again with code like so:
defaultdict(lambda: defaultdict(int))
That allows me to organically build dictionaries (mainly for stat building) using operands like +=.