4 ms·
I've been wanting this feature for a while as a clean way to combine the results from several queries into a composite object. def combined(*dicts):
by rectangletangle 11y ago
I've been wanting this feature for a while as a clean way to combine the results from several queries into a composite object.
def combined(*dicts):
return {k: v
for dict_ in dicts
for k, v in dict_.items()}
dicts = [({'a': 'a', 'b': 'b'}, {'b': 'bb'}),]
assert [{'a': 'a', 'b': 'bb'}] == [combined(a, b) for a, b in dicts]