pcollections


Namepcollections JSON
Version 0.2.6 PyPI version JSON
download
home_pagehttps://github.com/noahbenson/pcollections/
SummaryA persistent collections library for Python
upload_time2023-03-24 04:05:46
maintainer
docs_urlNone
authorNoah C. Benson
requires_python>=3.7
licenseMIT License Copyright (c) 2022 Noah C. Benson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords persistent immutable functional lazy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pcollections

A persistent collections library for Python.


## About

`pcollections` is a library of persistent (immutable) collections inspired by
the immutable data structures of [Clojure](clojure.org) but built to resemble
the native Python collections as closely as possible. The library is implemented
in Python but employs the [`phamt`](https://github.com/noahbenson/phamt)
(Persistent Hash Array Mapped Tries) library, which is implemented in C, to
perform efficient low-level operations.

The library implements three persistent types: `plist`, `pset`, and
`pdict`. These are immutable versions of the builtin `list`, `set`, and `dict`
types. The persistent object interfaces are as similar as possible to the native
types, but the method signatures differ in ways necessary to accomodate
efficient immutable ways of doing things. For example, the `pdict` constructor
is identical to the `dict` constructor and always returns a `pdict` equal to the
`dict` that would be created with the same arguments. However, instead of
supporting operations like `d[key] = val`, `pdicts` support a `set` method: `d =
d.set(key, val)`.

In addition to the persistent types, there are two lazy types, `llist` and
`ldict`. These types are enabled by the `lazy` type. A `lazy` object is
basically a `partial` object that, when called, caches the function's return
value and returns that value without rerunning the function on subsequent
calls. The `llist` and `ldict `types are equivalent to the `plist` and `pdict`
types with one exception. Elements of an `llist` and values of an `ldict` that
are of the `lazy` type are dereferenced when requested. This allows a programmer
to easily create data structures (potentially nested data structures) whose
items are the results of complex or long-running computations that only get
computed once requested. The persistent data structures allow the arguments to
these lazy functions to be safe from mutation.

Finally, the persistent and lazy types have transient correlaries that enable
more efficient batch-mutation of the persistent types. The transient types
`tlist`, `tset`, `tdict`, `tllist`, and `tldict` all have interfaces equivalent
to their standard mutable correlaries (transient types are mutable).


## License

MIT License

Copyright (c) 2022-2023 Noah C. Benson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/noahbenson/pcollections/",
    "name": "pcollections",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "persistent,immutable,functional,lazy",
    "author": "Noah C. Benson",
    "author_email": "\"Noah C. Benson\" <nben@uw.edu>",
    "download_url": "https://files.pythonhosted.org/packages/c4/33/5c086b1405e5cc328b5b3bb796ad0e9edaf765ad7aacf19b0145a7cfb0ee/pcollections-0.2.6.tar.gz",
    "platform": null,
    "description": "# pcollections\n\nA persistent collections library for Python.\n\n\n## About\n\n`pcollections` is a library of persistent (immutable) collections inspired by\nthe immutable data structures of [Clojure](clojure.org) but built to resemble\nthe native Python collections as closely as possible. The library is implemented\nin Python but employs the [`phamt`](https://github.com/noahbenson/phamt)\n(Persistent Hash Array Mapped Tries) library, which is implemented in C, to\nperform efficient low-level operations.\n\nThe library implements three persistent types: `plist`, `pset`, and\n`pdict`. These are immutable versions of the builtin `list`, `set`, and `dict`\ntypes. The persistent object interfaces are as similar as possible to the native\ntypes, but the method signatures differ in ways necessary to accomodate\nefficient immutable ways of doing things. For example, the `pdict` constructor\nis identical to the `dict` constructor and always returns a `pdict` equal to the\n`dict` that would be created with the same arguments. However, instead of\nsupporting operations like `d[key] = val`, `pdicts` support a `set` method: `d =\nd.set(key, val)`.\n\nIn addition to the persistent types, there are two lazy types, `llist` and\n`ldict`. These types are enabled by the `lazy` type. A `lazy` object is\nbasically a `partial` object that, when called, caches the function's return\nvalue and returns that value without rerunning the function on subsequent\ncalls. The `llist` and `ldict `types are equivalent to the `plist` and `pdict`\ntypes with one exception. Elements of an `llist` and values of an `ldict` that\nare of the `lazy` type are dereferenced when requested. This allows a programmer\nto easily create data structures (potentially nested data structures) whose\nitems are the results of complex or long-running computations that only get\ncomputed once requested. The persistent data structures allow the arguments to\nthese lazy functions to be safe from mutation.\n\nFinally, the persistent and lazy types have transient correlaries that enable\nmore efficient batch-mutation of the persistent types. The transient types\n`tlist`, `tset`, `tdict`, `tllist`, and `tldict` all have interfaces equivalent\nto their standard mutable correlaries (transient types are mutable).\n\n\n## License\n\nMIT License\n\nCopyright (c) 2022-2023 Noah C. Benson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Noah C. Benson  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A persistent collections library for Python",
    "version": "0.2.6",
    "split_keywords": [
        "persistent",
        "immutable",
        "functional",
        "lazy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4335c086b1405e5cc328b5b3bb796ad0e9edaf765ad7aacf19b0145a7cfb0ee",
                "md5": "a67528e0fb60069916ec53c7184f67d0",
                "sha256": "44bbb890e51347817299db6a07325fe06a7555261b362c5e8478356604848f68"
            },
            "downloads": -1,
            "filename": "pcollections-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "a67528e0fb60069916ec53c7184f67d0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 29922,
            "upload_time": "2023-03-24T04:05:46",
            "upload_time_iso_8601": "2023-03-24T04:05:46.832184Z",
            "url": "https://files.pythonhosted.org/packages/c4/33/5c086b1405e5cc328b5b3bb796ad0e9edaf765ad7aacf19b0145a7cfb0ee/pcollections-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-24 04:05:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "noahbenson",
    "github_project": "pcollections",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pcollections"
}
        
Elapsed time: 0.04752s