Skip to main content

Frozen implementations of your favorite collections.

Project description

Freeze

Freeze provides frozen (immutable) implementations of the basic Python collections - dict, set and list.

While there are built-in immutable versions for list (tuple) and set (frozenset), they are not always a good replacement for their mutable counterparts:

  • tuple can store mutable objects so its immutability is not guaranteed.
  • frozenset will raise an exception if you try to initialize it with any mutable object.
  • dict doesn't have a built-in immutable version.

Freeze introduces the following collections: FDict, FSet and FList.

They are immutable, hashable, type-hinted, and will attempt to convert mutable data to an equivalent immutable representation on initialization.

Freezing is achieved by following a simple logic recursively:

  • Immutable objects stay the same (except for collections).
  • Any Mapping (e.g. dict) is converted to an FDict.
  • Any AbstractSet (e.g. set) is converted to an FSet.
  • Any Sequence (e.g. list or tuple) is converted to an FList.

Attempting to initialize any Freeze collection with un-freezable objects will raise an exception.

Issues:

  • Type hints are only accurate as long as no data conversion was performed.

Future Plans:

  • support for thawing.
  • support for freezing more types.

Project details


Download files

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

Source Distribution

frz-0.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

frz-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file frz-0.0.1.tar.gz.

File metadata

  • Download URL: frz-0.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for frz-0.0.1.tar.gz
Algorithm Hash digest
SHA256 09210b66ff379ed8e5416a6ba5089677999453a900099a49cb96d1c05092cf3d
MD5 8eaddec4e51936dcbcb11d1a3b05ce94
BLAKE2b-256 9aef95ec5f48e312343167374db4c45bf20a210b16780ac475dfed9569ee90ac

See more details on using hashes here.

File details

Details for the file frz-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: frz-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for frz-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52ac30eb697188c74df25ee3aee2cf1b07ed2cfdb8e8b267b2daa98ad2db91d3
MD5 f6e126a83f73082acaff98c71d016aa1
BLAKE2b-256 6683dfd88f3ebf435c1bb931a5050d03b8c91b74f59d1a98903aa6005fe12f1e

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