Hi all, I've always done key creation/incrementation using:
if key in dict: dict[key] += 1 else: dict[key] = 1 Today I spotted an alternative: dict[key] = dict.get(key, 0) + 1 Whilst certainly more compact, I'd be interested in views on how pythonesque this method is. -- http://mail.python.org/mailman/listinfo/python-list