Sometimes I cannot use a lambda function on an object because the last method applied to the object returns None. What is the trick to be able to return the object itself instead of the method returned value?
Example, I want to get the updated copy of the dictionary instead of None:
dict_update = lambda d, upd: d.copy().update(upd)
d = dict(lw=3, ls='-')
upd = dict(c='C0', lw=4)
d1 = dict_update(d, upd)
for v in [d, upd, d1]: print(v)
{'lw': 3, 'ls': '-'}
{'c': 'C0', 'lw': 4}
None