Skip to main content

This package provides a collection that is basically a “dict of sets”, named MetaSet.

Build status Supported Python versions Wheel status License

Quickstart

Install the package from PyPI, using pip:

pip install metaset

Or from GitHub:

$ git clone git://github.com/lionel-panhaleux/metaset.git

Import it in your code:

from metaset import MetaSet

Usage is quite straight forward, basic set operations are supported via the binary operators + - | ^.

>>> MetaSet(a={1, 2}, b={3}) | MetaSet(b={4}, c={5})
{'a': {1, 2}, 'b': {3, 4}, 'c': {5}}

Detailed considerations

They are two ways to consider the “dict of sets” notion, differing on how you handle the empty values for keys.

The easiest idea is to consider that a key with no content is non-existent. This is how the dictset package is implemented.

In this alternative implementation, we chose to keep the empty keys as meaningful elements, allowing for smart unions and intersections.

>>> MetaSet(a={1}) | Metaset(a={2}, b=set())
{'a': {1, 2}, 'b': set()}

>>> MetaSet(a={1}) & Metaset(a={2}, b={3})
{'a': set()}

So, beware of how empty-keys are handled, and consider using dictset if it is a better match for your use case. The behavior for subtraction and symmetric difference, although sound on a mathematical point of view, may not be what you want.

>>> MetaSet(a={1}) - MetaSet(a={1})
{'a': set()}

>>> MetaSet(a={1}) ^ MetaSet(a={1})
{'a': set()}

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metaset-1.0.3-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file metaset-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for metaset-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7c7a9c5b8eb75de3a0b2503f649c8dad0fe19fec9a27c21b2c99a9076164daaf
MD5 7443ce4d12d6689498ac4cbdcaca3e89
BLAKE2b-256 3fe4195080425c78cc8021c7097e7df7520808c5f932020764f3058e1c3d5ebd

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

This release

1.0.3 This release

1 file

1.0.2

1 file

1.0.1

2 files

1.0.0

1 file

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