I have a dictionary with one key-value pair,
dct = {'a': 1}
I want to add more key-value pairs to this dictionary, so, I do,
{dct.update(**i) for i in [{'b': 2}, {'c': 3}, {'d': None}] if any(i.values())}
but the IDE starts suggesting to convert this into a variable, and marks the above line with a yellowish background
var = {dct.update(**i) for i in [{'b': 2}, {'c': 3}, {'d': None}] if any(i.values())}
then I add this variable, but it would go unused, and the IDE starts saying unused variable var
.
How do I update the dictionary, without IDE having any issues?