Skip to main content

PyPI Version Python Build Documentation Coverage Status python-versions contributors PRs Welcome Pull Requests Pull Requests Closed

Automatically Extending List

Getting started

List extending automatically to the maximum requested length.

Added indices are filled with None by default.

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

Slices and negative indices are supported likewise

>>> l[1:4]
[None, 'C', None]
>>> l[-3]
'C'

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

Installing it is pretty easy:

pip install defaultlist

Metadata

Release files for defaultlist 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 defaultlist 1.2.0
File Size Uploaded
defaultlist-1.2.0.tar.gz 4.6 kB Details

Built distribution (wheel)

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

Total release size: 9.0 kB

Release files / defaultlist-1.2.0.tar.gz

Download URL defaultlist-1.2.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2a023dedd77cb66b09cfe24c5587bae96f028e613157a871c8172e205ba6961f
BLAKE2b-256 checksum
How to use checksums
0f6869012445ee167dedf704d8c385249efa3ec139b9e2b6b302206959b8eb65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.24.2 CPython/3.13.3 Linux/6.11.0-1014-azure

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

Download URL defaultlist-1.2.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f508ec4481087001c35b27c61a1f347b0bccdb9161df7dd64d4cefc8c580c115
BLAKE2b-256 checksum
How to use checksums
4b5891ad13c854690c4d2b9f8ce18719acfa53675821a14cf2424fdda809cfed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.24.2 CPython/3.13.3 Linux/6.11.0-1014-azure

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.0.0

1 release file

0.1.0

1 release file

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