aahz at pythoncraft.com (Aahz) writes: > Standard Python idiom: > > try: > d[key] += value > except KeyError: > d[key] = value > > Maybe you need to re-think "appropriate". But more recent style prefers: d = collections.defaultdict(int) ... d[key] += value