The function collections.defaultdict returns a default value that can be defined by a lambda function of my own making if the key is absent from my dictionary.
Now, I wish my defaultdict to return the unmodified key-value if that key is absent. Thus, I use a lambda identity function lambda x:x. I expect the defaultdict to return the key.
>>>translation=defaultdict(lambda x:x)
>>>translation['Haus']='maison'
>>>translation['computer']='ordinateur'
>>>translation['computer']
'ordinateur'
However, when I present my defaultdict with a hitherto absent key:
>>>translation['email']
I expect the defaultdict translation to return 'email'. However, python 2.7 says:
TypeError: <lambda>() takes exactly 1 argument (0 given)
Surely I'm doing something silly. But what ?