Given two lists of dictionaries:
>>> lst1 = [{id: 1, x: \"one\"},{id: 2, x: \"two\"}] >>> lst2 = [{id: 2, x: \"two\"}, {id: 3, x: \"three\"
Perhaps the simplest option
result = {x['id']:x for x in lst1 + lst2}.values()
This keeps only unique ids in the list, not preserving the order though.
ids
If the lists are really big, a more realistic solution would be to sort them by id and merge iteratively.
id