python add value in dictionary in lambda expression
<p>Is it possible to add values in dictionary in lambda expression?</p>

<p>That is to implement a lambda which has the similar function as below methods.</p>

<pre><code>def add_value(dict_x):
    dict_x['a+b'] = dict_x['a'] + dict_x['b']
    return dict_x
</code></pre>

<p>You could build a custom dict, inheriting from <code>dict</code>, overriding its <code>__setitem__</code> function. <a href="https://docs.python.org/3/reference/datamodel.html?emulating-container-types#emulating-container-types" rel="nofollow">See the Python documentation.</a></p>

<pre><code>class MyCustomDict(dict):
    def __setitem__(self, key, item): 
        # your method here
</code></pre>

python