ChanTsune / list-reserve

Python builtin list memory allocation library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

list-reserve

Python builtin list memory allocation library.

PyPI - License Test PyPI Downloads

Getting it

pip install list_reserve

capacity

Return allocated list memory size.

from list_reserve import capacity

l = [1, 2, 3]
print(capacity(l)) # 3

reserve

Reserve list memory.

from list_reserve import reserve, capacity

l = []
reserve(l, 10)

print(len(l)) # 0

print(capacity(l)) # 10

shrink_to_fit

since 0.1.0
shrink to fit list capacity.

from list_reserve import capacity, shrink_to_fit

l = list(range(100))

print(capacity(l)) # 118

shrink_to_fit(l)

print(capacity(l)) # 100

License

MIT License

About

Python builtin list memory allocation library.

License:MIT License


Languages

Language:C 49.8%Language:Python 48.8%Language:Dockerfile 1.4%