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 dct[key] = dct.setdefault(key, 0) + 1