Hendrik van Rooyen <hendrik at microcorp.co.za> writes: > Standard Python idiom: > > if key in d: > d[key] += value > else: > d[key] = value The issue is that uses two lookups. If that's ok, the more usual idiom is: d[key] = value + d.get(key, 0)