3 ms·
In item 3, the "boilerplate" and the "awesome way" are not equivalent. The boilerplate does the equivalent of setdefault, which is mentioned later dct[key]
by taejo 14y ago
In item 3, the "boilerplate" and the "awesome way" are not equivalent. The boilerplate does the equivalent of setdefault, which is mentioned later
dct[key] = dct.setdefault(key, 0) + 1
- isbadawi 14y agoSince you're assigning to dct[key] anyway, it doesn't really matter.
- deleted 14y ago[deleted]