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 The Python Package Index (PyPI) .

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.8.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

sparse_list-0.8.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparse_list-0.8.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for sparse_list-0.8.2.tar.gz
Algorithm Hash digest
SHA256 1815f0fd86ba37f3e6671722675e9b343f44c2477e32f2d60b790b803a6ecb2e
MD5 2ddb12b7bfdade6384ddbe9d67836208
BLAKE2b-256 1c5cda29eef75cd99dfe638b592b480c75ff598a060d2bd74adc967c79cb1eb1

See more details on using hashes here.

File details

Details for the file sparse_list-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: sparse_list-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for sparse_list-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7d1966fb7e02b0d4bee900535dec5b789c099352190e673692090c39595844cf
MD5 2866c7dede21b069f47f66ae47ada2a2
BLAKE2b-256 f4e9994c75a858284ba22cf8cdc7dd822c99a2e270bb7921c71d98633839bf04

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