Skip to main content

collections.defaultdict equivalent implementation of list.

Project description

https://badge.fury.io/py/defaultlist.svg https://travis-ci.org/c0fec0de/defaultlist.svg?branch=master https://coveralls.io/repos/github/c0fec0de/defaultlist/badge.svg https://readthedocs.org/projects/defaultlist/badge/?version=0.1.0 https://codeclimate.com/github/c0fec0de/defaultlist.png

Documentation

The Documentation is hosted on http://defaultlist.readthedocs.io/en/0.1.0/

Getting started

List extending automatically to the maximum requested length.

Added indicies are filled with None by default.

>>> l = defaultlist()
>>> l
[]
>>> l[2] = "C"
>>> l
[None, None, 'C']
>>> l[4]
>>> l
[None, None, 'C', None, None]

Simple factory functions can be created via lambda.

>>> l = defaultlist(lambda: 'empty')
>>> l[2] = "C"
>>> l[4]
'empty'
>>> l
['empty', 'empty', 'C', 'empty', 'empty']

Installation

To install the defaultlist module run:

pip install defaultlist

If you do not have write-permissions to the python installation, try:

pip install defaultlist --user

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

defaultlist-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file defaultlist-0.1.0.tar.gz.

File metadata

  • Download URL: defaultlist-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for defaultlist-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f0d1cacae44fcad0186c5e13e6ef746fa2304355709eabde5dc992712853d35c
MD5 b5392ace9782062afba0b4f0152c2705
BLAKE2b-256 5589a49732c35138def732cc95550dfd29d148a676b9af5afae5fd99f1d94e8f

See more details on using hashes here.

Supported by

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