Possible Duplicate:
How to make a python dictionary that returns key for keys missing from the dictionary instead of raising KeyError?
I need something like a defaultdict
. However, for any key that isn't in the dictionary, it should return the key itself.
What is the best way to do that?