Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chantsune/list-reserve
Python builtin list memory allocation library.
https://github.com/chantsune/list-reserve
python
Last synced: 22 days ago
JSON representation
Python builtin list memory allocation library.
- Host: GitHub
- URL: https://github.com/chantsune/list-reserve
- Owner: ChanTsune
- License: mit
- Created: 2020-08-01T05:51:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-21T02:01:47.000Z (11 months ago)
- Last Synced: 2024-10-10T23:17:50.378Z (about 1 month ago)
- Topics: python
- Language: C
- Homepage:
- Size: 69.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# list-reserve
Python builtin list memory allocation library.
[![PyPI - License](https://img.shields.io/pypi/l/list_reserve)](https://pypi.org/project/list-reserve/)
![Test](https://github.com/ChanTsune/list-reserve/workflows/Test/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/list_reserve)](https://pypi.org/project/list-reserve/)
[![Downloads](https://pepy.tech/badge/list-reserve)](https://pepy.tech/project/list-reserve)## Getting it
```bash
pip install list_reserve
```### capacity
Return allocated list memory size.
```py
from list_reserve import capacityl = [1, 2, 3]
print(capacity(l)) # 3
```### reserve
Reserve list memory.
```py
from list_reserve import reserve, capacityl = []
reserve(l, 10)print(len(l)) # 0
print(capacity(l)) # 10
```### shrink_to_fit
*since 0.1.0*
shrink to fit list capacity.```py
from list_reserve import capacity, shrink_to_fitl = list(range(100))
print(capacity(l)) # 118
shrink_to_fit(l)
print(capacity(l)) # 100
```## License
[MIT License](./LICENSE)