Skip to main content

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.

Release files for frz 0.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 frz 0.0.1
File Size Uploaded
frz-0.0.1.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for frz 0.0.1
File Interpreter ABI Platform
frz-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / frz-0.0.1.tar.gz

Download URL frz-0.0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
09210b66ff379ed8e5416a6ba5089677999453a900099a49cb96d1c05092cf3d
BLAKE2b-256 checksum
How to use checksums
9aef95ec5f48e312343167374db4c45bf20a210b16780ac475dfed9569ee90ac
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / frz-0.0.1-py3-none-any.whl

Download URL frz-0.0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52ac30eb697188c74df25ee3aee2cf1b07ed2cfdb8e8b267b2daa98ad2db91d3
BLAKE2b-256 checksum
How to use checksums
6683dfd88f3ebf435c1bb931a5050d03b8c91b74f59d1a98903aa6005fe12f1e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

0.0.2

2 release files

This release

0.0.1 This release

2 release files

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