Skip to main content

MeldDict badge

A dict subclass that supports adding and subtracting other Mappings to perform recursive merging and removal.

By default, lists are also melded, but this can be configured. You can also have keys whose values are empty after a subtraction dropped automatically.

The full documentation is available online at: https://melddict.readthedocs.io/

Examples

You can add two mappings together to combine them:

meld_dict = MeldDict({'a': 'a',
                      'b': [1, 2],
                      'c': {'1': 1},
                      'd': 'd'})
norm_dict = {'b': [3, 4],
             'c': {'2': 2},
             'd': 'D',
             'e': 'e'}
meld_res = meld_dict + norm_dict
meld_res == {'a': 'a',
             'b': [1, 2, 3, 4],
             'c': {'1': 1, '2': 2},
             'd': 'D',
             'e': 'e'}
meld_dict += norm_dict  # a.k.a. meld_dict.add(norm_dict)
meld_dict == meld_res

You can also subtract one mapping from another:

meld_dict = MeldDict({'a': 'a',
                      'b': [1, 2],
                      'c': {'1': 1, '2': 2},
                      'd': 'd'})
norm_dict = {'b': [2, 3],
             'c': {'2': 2, '3': 3},
             'd': 'D',
             'e': 'e'}
meld_res = meld_dict - norm_dict
meld_res == {'a': 'a',
             'b': [1],
             'c': {'1': 1}}
meld_dict -= norm_dict  # a.k.a. meld_dict.subtract(norm_dict)
meld_dict == meld_res

Changelog

1.0.0

Tuesday Apr 3 2018

  • Initial release

Metadata

Release files for melddict 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for melddict 1.0.1
File Size Uploaded Provenance Actions
melddict-1.0.1.tar.gz 8.1 kB Without provenance Details for melddict-1.0.1.tar.gz

Release files / melddict-1.0.1.tar.gz

Download URL melddict-1.0.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
70ad91f4a7fb7ee32498e828604fe10c6ceb68a5779ca9d41e5469a6c24826ea
BLAKE2b-256 checksum
How to use checksums
8999c2dd9897264764544cb02de5fe0ffc277c091e973908b0894abe8900be7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for melddict 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page