Skip to main content

Finds intersections/differences in nested iterables

Project description

Finds intersections/differences in nested iterables

# Tested with:
# Python 3.9.13
# Windows 10


$pip install set-nested-iters


from set_nested_iters import (
    present_in_L1_and_L2,
    present_in_all_lists_reduce,
    unique_in_L1_and_L2,
    unique_in_each_list_reduce,
    present_only_in_L1,
    present_only_in_L1_reduce,
)
L0 = [{2, 5}, "a", 44, "jojjo", "xxx", {77: 100}]
L1 = [
    {2, 5},
    "a",
    ["bb", ["ccc", "ddd"], "ee", "ff"],
    "g",
    "h",
    "g",
    "h",
    3,
    4,
    5,
    0.0,
    1,
]
L2 = [
    {2, 5},
    "ac",
    (98, 11),
    ["bb", ["ccc", "ddd"], "ee", "ff"],
    "gc",
    "h",
    "gc",
    "h",
    11,
    2,
    3,
    1.0,
    0.0,
]
L3 = [
    {2, 5},
    "a",
    44,
    ["bb", ["ccc", "ddd"], "ee", "ff"],
    "g",
    "h",
    "g",
    "h",
    3,
    4,
    5,
    0.0,
    1,
]
L4 = [
    {2, 5},
    "ac",
    111112,
    (98, 11),
    ["bb", ["ccc", "ddd"], "ee", "ff"],
    "gc",
    "a",
    "h",
    "gc",
    "h",
    11,
    2,
    3,
    1.0,
    0.0,
]
erg0 = present_only_in_L1(L1, L2, withindex=False)
print(erg0)
erg1 = present_only_in_L1(L2, L1, withindex=False)
print(erg1)
erg2 = unique_in_L1_and_L2(L1, L2, withindex=False)
print(erg2)
erg3 = present_in_L1_and_L2(L1, L2, withindex=False)
print(erg3)
erg0 = present_only_in_L1(L1, L2, withindex=True)
print(erg0)
erg1 = present_only_in_L1(L2, L1, withindex=True)
print(erg1)
erg2 = unique_in_L1_and_L2(L1, L2, withindex=True)
print(erg2)
erg3 = present_in_L1_and_L2(L1, L2, withindex=True)
print(erg3)
print(present_in_all_lists_reduce(L1, [L2, L3, L4]))
print(unique_in_each_list_reduce(L1, [L2, L3, L4, L0]))
print(present_only_in_L1_reduce(L0, [L2, L3, L4, L1]))



['a', 'g', 4, 5]
['ac', (98, 11), 'gc', 11, 2]
['a', 'g', 4, 5, 'ac', (98, 11), 'gc', 11, 2]
[{2, 5}, ['bb', ['ccc', 'ddd'], 'ee', 'ff'], 'h', 3, 0.0, 1]
[(1, 'a'), (3, 'g'), (6, 4), (7, 5)]
[(1, 'ac'), (2, (98, 11)), (4, 'gc'), (6, 11), (7, 2)]
[(1, 'a'), (3, 'g'), (6, 4), (7, 5), (1, 'ac'), (2, (98, 11)), (4, 'gc'), (6, 11), (7, 2)]
[(0, {2, 5}), (2, ['bb', ['ccc', 'ddd'], 'ee', 'ff']), (4, 'h'), (5, 3), (8, 0.0), (9, 1)]
[{2, 5}, ['bb', ['ccc', 'ddd'], 'ee', 'ff'], 'h', 3, 0.0, 1]
[111112, {2, 5}, 'jojjo', 'xxx', {77: 100}]
['jojjo', 'xxx', {77: 100}]
	

Project details


Release history Release notifications | RSS feed

This version

0.10

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

set_nested_iters-0.10.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

set_nested_iters-0.10-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file set_nested_iters-0.10.tar.gz.

File metadata

  • Download URL: set_nested_iters-0.10.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for set_nested_iters-0.10.tar.gz
Algorithm Hash digest
SHA256 3a510d014bf392eba3a0d83bf5830894d86509e735a46dd18beadf0d5886fdac
MD5 1744daf83703a21bec5947c6968366c0
BLAKE2b-256 b9b0d84c6c62c1048a77f47f064199196fe2491adc4c51e62d6737b95bbe16c7

See more details on using hashes here.

File details

Details for the file set_nested_iters-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for set_nested_iters-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4f94665ee610450583dfac150a7bf92b8fd672f769b84a6a8e3d82662d7b55df
MD5 e27bba151299a27c490dfa4501ef4c59
BLAKE2b-256 75676d1fe9c9b958090a016092c81e0b457f2569f8a8ef73a55b327367295940

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page