A list where most values will be None (or some other default)
Project description
Inspired by the post Populating a sparse list with random 1’s on StackOverflow.
A “sparse list” is a list where most values will be None (or some other default) and for reasons of memory efficiency you don’t wish to store these (cf. Sparse array).
This implementation has a similar interface to Python’s built-in list but stores the data in a dictionary to conserve memory.
Installation
sparse_list is available from The Python Package Index (PyPI) .
Installation is simply:
$ pip install sparse_list
Usage
See the unit-tests!
Contributing
Fork it
Create your feature branch (git checkout -b my-new-feature)
Commit your changes (git commit -am 'Add some feature')
Ensure the tests pass for all Pythons in .python.yml
Push to the branch (git push origin my-new-feature)
Create new Pull Request
Thanks
If you find this stuff useful, please follow this repository on GitHub. If you have something to say, you can contact johnsyweb on Twitter and GitHub.
Many thanks
I’m grateful for contributions to what was a solo project (hooray for GitHub :octocat:)! If you’d like to thank the contributors, you can find their details here:
https://github.com/johnsyweb/python_sparse_list/graphs/contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sparse_list-1.0.tar.gz
.
File metadata
- Download URL: sparse_list-1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bd4178f8528c6534a963985bcb2669a78759d4a0f7c24d54560d4f24ce3878c |
|
MD5 | 4169b7a17d32f5a09f6fe72638ebaad2 |
|
BLAKE2b-256 | d6700d8ea47ca5f6642ef4e2c2a8c515df4c1d23e9f218b3e24843b70888f8ee |
File details
Details for the file sparse_list-1.0-py3-none-any.whl
.
File metadata
- Download URL: sparse_list-1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eedc0954e915764b603abd805047974105f3da2246d95aa4a0268e5199650fda |
|
MD5 | f978f363684f13c18e8d1779ee30dac3 |
|
BLAKE2b-256 | dddfec18692323270e7c19067d67cec6d6a87a445759a09886fa7beb8ce345fa |