Deep compare python structures like dictionaries, lists and iterables.
Project description
Deepcomparer
Deep compare python structures like dictionaries, lists and iterables.
Usage
from deepcomparer import deep_compare
user: dict = {
'name': 'ash',
'links': {
'pokehub': '@ash'
}
}
user2: dict = {
'name': 'ash',
'links': {
'pokehub': '@brock'
}
}
print(deep_compare(user, user2))
# output: False
user2['links']['pokehub'] = '@ash'
print(deep_compare(user, user2))
# output: True
from deepcomparer import deep_compare
ash_data: dict = {
'name': 'ash',
'links': {
'pokehub': '@ash'
}
}
brock_data: dict = {
'name': 'brock',
'links': {
'pokehub': '@brock'
}
}
# Over iterable structures
print(deep_compare([ash_data, brock_data], [ash_data, brock_data]))
# output: True
# Over iterable structures
print(deep_compare([ash_data, brock_data], [brock_data, ash_data]))
# output: False
# Over unsorted iterable structures
print(deep_compare([ash_data, brock_data], [brock_data, ash_data], ignore_order=True))
# output: True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deepcomparer-0.0.3.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for deepcomparer-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef12b723629912c0ce763fa09dbfe24aabbfe7681728afa48d9e934fab2f90f |
|
MD5 | 2f83f7044e8892933b32cab5dfdc18c8 |
|
BLAKE2b-256 | a26b5a01c5b4c39046c08848bbf83dea533c060a5ee137b0f0fccd9962615e84 |