Technically, you can use a side effect to update it and use that Nonereturned from .updateis false to return a dict through based on logical operations:
add_value = lambda d: d.update({'a+b': d['a'] + d['b']}) or d
I just don’t see the reasons for this in real code, although with both a lambda and a function you wrote.
source
share