Skip to main content

A list where most (>95%) values will be None (or 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 (say, more than 95% of) 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 PyPI - the Python Package Index (aka The Cheeseshop).

Installation is simply:

$ pip install sparse_list

Usage

See the unit-tests!

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Ensure the tests pass for all Pythons in .travis.yml

  5. Push to the branch (git push origin my-new-feature)

  6. 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


Download files

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

Source Distribution

sparse_list-0.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

sparse_list-0.6-py2-none-any.whl (4.1 kB view details)

Uploaded Python 2

File details

Details for the file sparse_list-0.6.tar.gz.

File metadata

  • Download URL: sparse_list-0.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sparse_list-0.6.tar.gz
Algorithm Hash digest
SHA256 729e759930a453ad059dbd92fdf20cdcdfcc20e04832eabde1a8cf20faf9b67b
MD5 c1c8b241b4a05e47718dcd06e6698daf
BLAKE2b-256 36318137ae854b9e0dd942bffb1985477a95dc967a5e0a914325dee9e36e3a32

See more details on using hashes here.

File details

Details for the file sparse_list-0.6-py2-none-any.whl.

File metadata

File hashes

Hashes for sparse_list-0.6-py2-none-any.whl
Algorithm Hash digest
SHA256 53f107e32c7e4ab54fb0d8a688b045216418dab1c0090b3a199190da3c7a535c
MD5 ad2e6a29b2868dc2f7c2c56877475e3c
BLAKE2b-256 ec0534d6c3fe1039cb25b64cc190a93528b08069890a188e8f9333fbe9009449

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page