When initializing a dictionary with d = {} Pycharm\'s code inspector generates a warning, saying
This dictionary creation could be rewrit
I have a situation where this warning is bugging the hell out of me. In my case, I'm populating my dict partially as literals and partially from a tuple output by a function, like so:
def get_other_values():
return 3, 4
foo = {
"a": 1,
"b": 2
}
foo["c"], foo["d"] = get_other_values()
So, unless I create interim vars for the output of get_other_values, PEP8 generates this warning even though I'm creating the dict with literals. And I can't assign the c and d keys in the literal, since the values are output as a tuple.