Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes: > For the record, the four lines Paul implies are "confusing" are: > > try: > d[key] += value > except KeyError: > d[key] = value Consider what happens if the computation of "key" or "value" itself raises KeyError.