deque-one


Namedeque-one JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/styfenschaer/deque-one
Summarylike collections.deque, but different
upload_time2023-10-15 19:45:05
maintainer
docs_urlNone
authorStyfen Schär
requires_python
license
keywords deque collections data-structure python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # deque-one
[![PyPI version](https://img.shields.io/pypi/v/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)
[![License](https://img.shields.io/pypi/l/deque-one?color=%2347ccbd)](https://opensource.org/licenses/BSD-3-Clause)
[![python](https://img.shields.io/pypi/pyversions/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)
[![status](https://img.shields.io/pypi/status/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)
[![downloads](https://img.shields.io/pypi/dm/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)

*Work-in-progress* drop-in replacement for Python's [`collection.deque`](https://docs.python.org/3/library/collections.html#collections.deque) with O(1) item access and without sacrificing performance on other metrics.

## Getting Started
The easiest way to get deque-one is to:
```
$ pip install deque-one
```
Alternatively, you can build it from source:
```
$ git clone https://github.com/styfenschaer/deque-one.git
$ cd deque-one
$ python setup.py install
``` 
The latter requires a C compiler compatible with your Python installation.

Once installed, it behaves like the built-in `deque` but with O(1) instead of O(n) random item access:
```python
import collections
import deque_one

col_deque = collections.deque(range(1_000_000))
one_deque = deque_one.deque(range(1_000_000))

%timeit col_deque[0]
%timeit one_deque[0]
# 33.6 ns ± 0.422 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
# 33.3 ns ± 1.08 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)

%timeit col_deque[500_000]
%timeit one_deque[500_000]
# 89.3 µs ± 1.93 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
# 38.2 ns ± 1.45 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
```

## Implemented Methods
- `__init__` (only first argument)
- `append`
- `appendleft`
- `pop`
- `popleft`
- `extend`
- `extendleft`
- `clear`
- `__getitem__`
- `__setitem__`
- `__len__`
- `__repr__`
- `__str__`

## Implemented Properties
- `maxlen` (always `None`)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/styfenschaer/deque-one",
    "name": "deque-one",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "deque,collections,data-structure,python",
    "author": "Styfen Sch\u00e4r",
    "author_email": "styfen.schaer.blog@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/06/4d3058bd0ad0cc39309cbade74c3f89cb193da702b0b5d03f3216cc4f7f4/deque-one-0.0.1.tar.gz",
    "platform": null,
    "description": "# deque-one\n[![PyPI version](https://img.shields.io/pypi/v/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)\n[![License](https://img.shields.io/pypi/l/deque-one?color=%2347ccbd)](https://opensource.org/licenses/BSD-3-Clause)\n[![python](https://img.shields.io/pypi/pyversions/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)\n[![status](https://img.shields.io/pypi/status/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)\n[![downloads](https://img.shields.io/pypi/dm/deque-one?color=%2347ccbd)](https://pypi.org/project/deque-one/)\n\n*Work-in-progress* drop-in replacement for Python's [`collection.deque`](https://docs.python.org/3/library/collections.html#collections.deque) with O(1) item access and without sacrificing performance on other metrics.\n\n## Getting Started\nThe easiest way to get deque-one is to:\n```\n$ pip install deque-one\n```\nAlternatively, you can build it from source:\n```\n$ git clone https://github.com/styfenschaer/deque-one.git\n$ cd deque-one\n$ python setup.py install\n``` \nThe latter requires a C compiler compatible with your Python installation.\n\nOnce installed, it behaves like the built-in `deque` but with O(1) instead of O(n) random item access:\n```python\nimport collections\nimport deque_one\n\ncol_deque = collections.deque(range(1_000_000))\none_deque = deque_one.deque(range(1_000_000))\n\n%timeit col_deque[0]\n%timeit one_deque[0]\n# 33.6 ns \u00b1 0.422 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000,000 loops each)\n# 33.3 ns \u00b1 1.08 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000,000 loops each)\n\n%timeit col_deque[500_000]\n%timeit one_deque[500_000]\n# 89.3 \u00b5s \u00b1 1.93 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n# 38.2 ns \u00b1 1.45 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000,000 loops each)\n```\n\n## Implemented Methods\n- `__init__` (only first argument)\n- `append`\n- `appendleft`\n- `pop`\n- `popleft`\n- `extend`\n- `extendleft`\n- `clear`\n- `__getitem__`\n- `__setitem__`\n- `__len__`\n- `__repr__`\n- `__str__`\n\n## Implemented Properties\n- `maxlen` (always `None`)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "like collections.deque, but different",
    "version": "0.0.1",
    "project_urls": {
        "Download": "https://github.com/styfenschaer/deque-one",
        "Homepage": "https://github.com/styfenschaer/deque-one"
    },
    "split_keywords": [
        "deque",
        "collections",
        "data-structure",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c97abd7821a19a1158e781fa2232f27fbd68467a549201b1091dd9f90766e8f6",
                "md5": "67ae079db038367e862d13de53d9c9f1",
                "sha256": "74185316d248f079cf5a25067be2167ca9620be06f3fe6f235edb69fd958ee26"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp310-cp310-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "67ae079db038367e862d13de53d9c9f1",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 12681,
            "upload_time": "2023-10-15T19:44:47",
            "upload_time_iso_8601": "2023-10-15T19:44:47.728495Z",
            "url": "https://files.pythonhosted.org/packages/c9/7a/bd7821a19a1158e781fa2232f27fbd68467a549201b1091dd9f90766e8f6/deque_one-0.0.1-cp310-cp310-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d71260708a6a094f39af8a3762cbc7e790dbf143b0042833a83e68fa20f19c6e",
                "md5": "74318c4ab49dff8f756404787ce11803",
                "sha256": "eb00a93b6368e608de2cef2a386fb8be3ee8b271e760a989edaabc702eb57384"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp310-cp310-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "74318c4ab49dff8f756404787ce11803",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 12929,
            "upload_time": "2023-10-15T19:44:49",
            "upload_time_iso_8601": "2023-10-15T19:44:49.978109Z",
            "url": "https://files.pythonhosted.org/packages/d7/12/60708a6a094f39af8a3762cbc7e790dbf143b0042833a83e68fa20f19c6e/deque_one-0.0.1-cp310-cp310-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90a2fe7f6d9b5a866bfba449888cf09f6aa06eb21ff027cbdc1783ed68f4ee29",
                "md5": "49fa9b0c55006a18df86402ba45fcb1c",
                "sha256": "6f657f26435b77c756aa6835f408a00b61432832f12bbf2dd1b74b56eb7cda9a"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "49fa9b0c55006a18df86402ba45fcb1c",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 34712,
            "upload_time": "2023-10-15T19:44:51",
            "upload_time_iso_8601": "2023-10-15T19:44:51.459461Z",
            "url": "https://files.pythonhosted.org/packages/90/a2/fe7f6d9b5a866bfba449888cf09f6aa06eb21ff027cbdc1783ed68f4ee29/deque_one-0.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "428b159d9a34086b2d7afe1d65dc743e761ec88c096445b56e0171df8f314508",
                "md5": "9b44da165d0078524fa730dab7cfd704",
                "sha256": "848914869c36154e30a5915a2224936025404f0ac37bcede974642d7e548a89c"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "9b44da165d0078524fa730dab7cfd704",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 15870,
            "upload_time": "2023-10-15T19:44:53",
            "upload_time_iso_8601": "2023-10-15T19:44:53.035099Z",
            "url": "https://files.pythonhosted.org/packages/42/8b/159d9a34086b2d7afe1d65dc743e761ec88c096445b56e0171df8f314508/deque_one-0.0.1-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f125f6da2971877b25385c7591ef1b4ed8b4e018cc6d93a824e96d7957a08ce5",
                "md5": "02db4707b93eea8081c6a59a1aa0e510",
                "sha256": "074b59dfc79a474270869cdcb6d4b4a2317b0d750ec1950e1928215c850e02d7"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "02db4707b93eea8081c6a59a1aa0e510",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 12681,
            "upload_time": "2023-10-15T19:44:53",
            "upload_time_iso_8601": "2023-10-15T19:44:53.967572Z",
            "url": "https://files.pythonhosted.org/packages/f1/25/f6da2971877b25385c7591ef1b4ed8b4e018cc6d93a824e96d7957a08ce5/deque_one-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "442e4e7cfaa0c2bcb8122df0651180cfc3c2fe7af75d9fb2d03d3b9e139f9728",
                "md5": "9ea55fc09f062fbba8d1e75f6bea918a",
                "sha256": "52f215958ca8c3e31385ae664b50fa09e147aa4385c18a587b265fc31d8649cb"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp311-cp311-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "9ea55fc09f062fbba8d1e75f6bea918a",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 12931,
            "upload_time": "2023-10-15T19:44:55",
            "upload_time_iso_8601": "2023-10-15T19:44:55.263543Z",
            "url": "https://files.pythonhosted.org/packages/44/2e/4e7cfaa0c2bcb8122df0651180cfc3c2fe7af75d9fb2d03d3b9e139f9728/deque_one-0.0.1-cp311-cp311-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ecd91bfa1dcfe0d1339bf7993c60cb936d976600c71ebab700666c8677758a7c",
                "md5": "274696603fccb1229d30411328122e2c",
                "sha256": "0aef2de8e5c69d2f6f473797a752631f9a144d0341cce2cc883a969fa66a284c"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "274696603fccb1229d30411328122e2c",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 36307,
            "upload_time": "2023-10-15T19:44:56",
            "upload_time_iso_8601": "2023-10-15T19:44:56.851568Z",
            "url": "https://files.pythonhosted.org/packages/ec/d9/1bfa1dcfe0d1339bf7993c60cb936d976600c71ebab700666c8677758a7c/deque_one-0.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc60c28d09e973d9b32158b4dd779e2d44cdeaae20150ac849534b7161f20619",
                "md5": "8e5b75fd0d6662bf795498db7dca514b",
                "sha256": "9d8d7ad0b9b4cb29b455a92b73d43f5f0f578497c3a17c23e0c68e65dec6bfb1"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "8e5b75fd0d6662bf795498db7dca514b",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 15870,
            "upload_time": "2023-10-15T19:44:58",
            "upload_time_iso_8601": "2023-10-15T19:44:58.191716Z",
            "url": "https://files.pythonhosted.org/packages/cc/60/c28d09e973d9b32158b4dd779e2d44cdeaae20150ac849534b7161f20619/deque_one-0.0.1-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a4318a3b56278abda5a9e91f911a91a7d6c69f7c7aa14f398b1692a5985de0b",
                "md5": "c1664e03efbeab27d1598c3900f8ed4a",
                "sha256": "8809f58c3a75ebbe2a0a349ba1621fef04fb7e0df8c8f1648aaff98cafdc3841"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp312-cp312-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "c1664e03efbeab27d1598c3900f8ed4a",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 12779,
            "upload_time": "2023-10-15T19:44:59",
            "upload_time_iso_8601": "2023-10-15T19:44:59.675501Z",
            "url": "https://files.pythonhosted.org/packages/1a/43/18a3b56278abda5a9e91f911a91a7d6c69f7c7aa14f398b1692a5985de0b/deque_one-0.0.1-cp312-cp312-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "342716071bb8de0ca6ac99088fe1d985d49f2bbd73829f0217f163903c26e836",
                "md5": "4ef2b67264becfcc4b896076fb729b30",
                "sha256": "ccd13677c4d5c889bd33bf1cf1823671ddf66ed7e809d1f860e9791f68ca86a5"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp312-cp312-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "4ef2b67264becfcc4b896076fb729b30",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 12994,
            "upload_time": "2023-10-15T19:45:01",
            "upload_time_iso_8601": "2023-10-15T19:45:01.234811Z",
            "url": "https://files.pythonhosted.org/packages/34/27/16071bb8de0ca6ac99088fe1d985d49f2bbd73829f0217f163903c26e836/deque_one-0.0.1-cp312-cp312-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9287cac76f2bf47501e94ec8bf3e59a8f4f26b8ec081577fee6dbb7b751b208c",
                "md5": "8b4922f8a75f6e82313b3ea8e69f0218",
                "sha256": "0bd346e0f4d2eafcc4c6fdc42a19646d4fec00e2c9204cc985fb34e9322e3c7a"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "8b4922f8a75f6e82313b3ea8e69f0218",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 37062,
            "upload_time": "2023-10-15T19:45:03",
            "upload_time_iso_8601": "2023-10-15T19:45:03.170807Z",
            "url": "https://files.pythonhosted.org/packages/92/87/cac76f2bf47501e94ec8bf3e59a8f4f26b8ec081577fee6dbb7b751b208c/deque_one-0.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5402bbc539fecb796c9387b79b99c5e61341b5fcb83a3ef9bcf04f2902675cbe",
                "md5": "88f6ff01e593d2f73b5b5a8ab4f8b09d",
                "sha256": "4644f363df04dcff3340a5c8f8277790752c2ded5d4bb5f8559ca789b7ae7758"
            },
            "downloads": -1,
            "filename": "deque_one-0.0.1-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "88f6ff01e593d2f73b5b5a8ab4f8b09d",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 15913,
            "upload_time": "2023-10-15T19:45:04",
            "upload_time_iso_8601": "2023-10-15T19:45:04.298391Z",
            "url": "https://files.pythonhosted.org/packages/54/02/bbc539fecb796c9387b79b99c5e61341b5fcb83a3ef9bcf04f2902675cbe/deque_one-0.0.1-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf064d3058bd0ad0cc39309cbade74c3f89cb193da702b0b5d03f3216cc4f7f4",
                "md5": "d83cf4c9438bb8b312dfe0892e1c8cc7",
                "sha256": "c25c8b61893fe0942c4d4d60b4821ba9ec1539fe3daeee56492439a4b045b5c1"
            },
            "downloads": -1,
            "filename": "deque-one-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d83cf4c9438bb8b312dfe0892e1c8cc7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16603,
            "upload_time": "2023-10-15T19:45:05",
            "upload_time_iso_8601": "2023-10-15T19:45:05.430636Z",
            "url": "https://files.pythonhosted.org/packages/bf/06/4d3058bd0ad0cc39309cbade74c3f89cb193da702b0b5d03f3216cc4f7f4/deque-one-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-15 19:45:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "styfenschaer",
    "github_project": "deque-one",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "deque-one"
}
        
Elapsed time: 2.68549s