Giter Club home page Giter Club logo

list-reserve's Introduction

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

list-reserve's People

Contributors

chantsune avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

list-reserve's Issues

Broken CI on windows runner

CI is broken on windows runner.

DEPRECATION: Python 3.5 reached the end of its life on September [13](https://github.com/ChanTsune/list-reserve/runs/5382096073?check_suite_focus=true#step:4:13)th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Requirement already satisfied: pip in c:\hostedtoolcache\windows\python\3.5.4\x64\lib\site-packages (20.3.4)
Collecting pip
  Using cached pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
running install
running bdist_egg
running egg_info
creating list_reserve.egg-info
writing dependency_links to list_reserve.egg-info\dependency_links.txt
writing top-level names to list_reserve.egg-info\top_level.txt
writing list_reserve.egg-info\PKG-INFO
writing manifest file 'list_reserve.egg-info\SOURCES.txt'
C:\hostedtoolcache\windows\Python\3.5.4\x64\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
package init file 'list_reserve\__init__.py' not found (or not a regular file)
reading manifest file 'list_reserve.egg-info\SOURCES.txt'
writing manifest file 'list_reserve.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\list_reserve
copying list_reserve\py.typed -> build\lib.win-amd64-3.5\list_reserve
copying list_reserve\__init__.pyi -> build\lib.win-amd64-3.5\list_reserve
running build_ext
building 'list_reserve' extension
error: Microsoft Visual C++ [14](https://github.com/ChanTsune/list-reserve/runs/5382096073?check_suite_focus=true#step:4:14).0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Error: Process completed with exit code 1.

Compiler warning C4244

src/list_reserve.c(91): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'long', possible loss of data

Compiler warning C4267

src/list_reserve.c(110): warning C4267: 'initializing': conversion from 'size_t' to 'long', possible loss of data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.