inveniosoftware / inveniosoftware/dictdiffer

possible to diff lists of dicts?

Open
#131 16 comments 1 reaction 0 assignees View on GitHub
Type: discussion Type: enhancement
Dominant language
Python
Stars
849
Forks
99
PR merge metrics
No merged PRs in 30d

Description

I'm trying to use dictdiffer to get the diff of two lists of dictionaries, but its not working well. It seems to get confused whenever the ordering of the dicts inside the list is not identical between the two lists, or when the number of dictionaries in one list is (slightly) different from the other list.

Is this functionality something that is currently possible and expected to work, or am I trying to accomplish something unsupported?

In case it matters, this is an example of a list of dictionaries that I'm trying to work with:
```
[{'prefix': '162.245.48.104/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.112/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.120/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.128/27',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.16/28',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.160/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.168/29',
'effective_as_path_length': 1,
'med': 15,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.176/28',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.192/30',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.200/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.208/30',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.216/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.224/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.232/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.240/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.248/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.32/29',
'effective_as_path_length': 1,
'med': 15,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.40/29',
'effective_as_path_length': 1,
'med': 15,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.48/29',
'effective_as_path_length': 1,
'med': 15,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.56/29',
'effective_as_path_length': 1,
'med': 15,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.64/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.72/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.48.96/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.50.0/24',
'effective_as_path_length': 1,
'med': 6,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.51.112/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.51.120/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.51.128/28',
'effective_as_path_length': 1,
'med': 15,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']},
{'prefix': '162.245.51.144/29',
'effective_as_path_length': 1,
'med': 0,
'destination': ['abcd.jln001.norc'],
'origin_asn': ['393467'],
'next_hop_asn': ['393467']}]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.