Skip to main content

alistpy

An Association List construct for Python


Install

pip install alistpy


Usage

This simple library provides an AList object that should be a drop-in replacement for most dictionaries, but based on immutable data structures instead.

Cheap to construct, expensive to mutate, as it isn't mutable. Every mutative method actually generates a new AList in it's place.

Example:

import alist

# This is cheap:
a = alist.AList(x=0,y=1)

# This is also cheap:
print(a['x'])

# This is expensive:
a['x'] = 12

Differences to Dictionaries

There's primarily two differences:

  • Mutating the AList is expensive, rather than cheap.

  • Setting the same key multiple times at init time is a ValueError.

That is, Python is happy with:

{'x': 0, 'x': 4}
> {'x': 4}

That sort of behaviour might be unexpected, or cause unexpected problems for the programmer.

So, instead alist:

alist.AList(x=0, x=4)
> Exception raised, ValueError

Issues

Issue tracker.

Anonymous users (those without accounts) are welcome to submit issues.


Explicit API

There isn't one yet.

Check back in future versions. For now, be guided by the tests.


Testing

Install pytest, and then run it.

Currently 31 tests for 21 methods.


License

BSD-3 Clause. See LICENSE.md for more.

Metadata

Release files for alistpy 1.2.0

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

Source distribution (sdist)

Source distribution for alistpy 1.2.0
File Size Uploaded Provenance
alistpy-1.2.0.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 7.7 kB

Release files / alistpy-1.2.0.tar.gz

Download URL alistpy-1.2.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bfad691198fa61e883894496a5d68c9e13025085d72f3018866a479cb75912dc
BLAKE2b-256 checksum
How to use checksums
74a9849bc2e053f1549fed46948cf1930a6e1a15f14c96c00e2fc72edaa110b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

Release files / alistpy-1.2.0-py3-none-any.whl

Download URL alistpy-1.2.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4da01874b1514803099f81f79b8555277c1c4a125af769784a0dfca3059200a
BLAKE2b-256 checksum
How to use checksums
cf794aea99ffa3c7603ad36859d015cceeef21eeab07b0813adb82f58541c468
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

Security for alistpy 1.2.0

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.

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