Automatically Extending List
Project description
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
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
defaultlist-1.2.0.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file defaultlist-1.2.0.tar.gz
.
File metadata
- Download URL: defaultlist-1.2.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.24.2 CPython/3.13.3 Linux/6.11.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
2a023dedd77cb66b09cfe24c5587bae96f028e613157a871c8172e205ba6961f
|
|
MD5 |
a8440911d3e29a36f4b86322654e782b
|
|
BLAKE2b-256 |
0f6869012445ee167dedf704d8c385249efa3ec139b9e2b6b302206959b8eb65
|
File details
Details for the file defaultlist-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: defaultlist-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.24.2 CPython/3.13.3 Linux/6.11.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f508ec4481087001c35b27c61a1f347b0bccdb9161df7dd64d4cefc8c580c115
|
|
MD5 |
8d3c08a5c096905ef43e695b70a59b10
|
|
BLAKE2b-256 |
4b5891ad13c854690c4d2b9f8ce18719acfa53675821a14cf2424fdda809cfed
|