data_list = [{"a": "123", "b": "321"}, {"a": "123", "b": "321"}, {"b": "321", "a": "123"}] run_function = lambda x, y: x if y in x else x + [y] return reduce(run_function, [[], ] + data_list)