Is it possible to have a default dictionary where the default is dependent on the key?
I was hoping something like this might work:
>>> m = defaultdict(lambda key: key+1)
But it obviously doesn't:
>>> m[3]
Traceback (most recent call last):
File "", line 1, in
TypeError: () takes exactly 1 argument (0 given)