{ "info": { "author": "Sven Over", "author_email": "sp@cedenti.st", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "pyimmutable\n===========\n\n.. image:: https://travis-ci.org/spacedentist/pyimmutable.svg?branch=master\n :target: https://travis-ci.org/spacedentist/pyimmutable\n\n.. image:: https://img.shields.io/badge/License-MIT-blue.svg\n :alt: License: MIT\n :target: https://opensource.org/licenses/MIT\n\n`API documentation `_ is hosted on GitHub pages.\n\n.. end-header\n\n\nIntroduction\n============\n\npyimmutable offers two immutable data types for Python3.6+: a mapping (similar to ``dict``, but, obviously immutable) and a sequence (like ``list``). It is implemented in C++, using the faboulous \"`immer `__\" library for efficiently implementing the immutable data structures.\n\nWhen your Python code passes an ``ImmutableDict`` or an ``ImmutableList`` to some function, you do not have to worry that function may alter the contents of that object. A reference to such an immutable data structure is guaranteed to forever point to the same data. If you do want to change the contents of your data, you have to update the reference. So instead of ``data[\"foo\"] = \"bar\"`` you will have to write ``data = data.set(\"foo\", \"bar\")``. As a result, your ``data`` variable will be updated, but any other variable that referenced ``data`` before the change will keep referencing the old ``data``---the one before the update.\n\nImmutable data structures like this allow for some interesting optimization features. For example, two ``ImmutableDict`` objects with identical content are not actually two objects but one and the same object, and the same is true for ``ImmutableList``. If any operation returns an ``ImmutableDict`` or an ``ImmutableList`` that is identical to one that has been constructed earlier, the existing one is returned instead of a new one being constructed. This entails that e.g. two ``ImmutableDict`` objects, even if they represent big trees of data, can be compared using the Python ``is`` operation.\n\npyimmutable has a stricter requirement for equality than the usual Python convention. In a nutshell, for pyimmutable, the integer ``3`` and the float ``3.0`` are not equal. An ``ImmutableDict`` can store different values for the keys ``3`` and ``3.0``, whereas a normal Python ``dict`` cannot. You can use objects of `any` type as keys and values, but only identical objects are considered equal. There is an exception to this rule for a small set of built-in types (`int`, `float`, `str`, `bytes`, `tuple`---all of which are immutable themselves), which are considered equal when they contain the same data.\n\nExample\n-------\n\n>>> from pyimmutable import ImmutableDict\n>>> d1 = ImmutableDict()\n\n``d1`` is an empty immutable dictionary.\n\n>>> d2 = d1.set(\"foo\", \"bar\")\n\n``d2`` contains one key (\"foo\") whose value is \"bar\". ``d1`` is remains an empty immutable dictionary.\n\n>>> d3 = d2.set(\"fox\", \"baz\")\n\n``d3`` now contains two keys (\"foo\", \"fox\") with values \"bar\" and \"baz\", respectively. ``d1`` and ``d2`` remain unchanged.\n\n>>> d4 = ImmutableDict(foo=\"bar\", fox=\"baz\")\n\n``d4`` is a newly constructed ``ImmutableDict``, initialized with values ``foo`` and ``fox`` that happen to be the same as in ``d3``. In such a case, pyimmutable does not actually construct a `new` ``ImmutableDict`` for us, but returns the ``d3`` object from earlier.\n\n>>> d3 is d4\nTrue\n\nThis is fine, because ``ImmutableDict`` objects are immutable, and since the objects referred to by ``d3`` and ``d4`` can never be mutated and therefore will always have the same contents, ``d3`` and ``d4`` might as well refer to the same object.", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "https://github.com/spacedentist/pyimmutable/archive/0.2.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/spacedentist/pyimmutable", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyimmutable", "package_url": "https://pypi.org/project/pyimmutable/", "platform": "", "project_url": "https://pypi.org/project/pyimmutable/", "project_urls": { "Download": "https://github.com/spacedentist/pyimmutable/archive/0.2.1.tar.gz", "Homepage": "https://github.com/spacedentist/pyimmutable" }, "release_url": "https://pypi.org/project/pyimmutable/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Immutable dict and lists", "version": "0.2.1", "yanked": false, "yanked_reason": null }, "last_serial": 6439473, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3979d93affdfd680cd8dff98b883e089", "sha256": "6d90135dfb2db11e28369507ab24ac23b493b87fd0ea126bdfa0a0599ae80136" }, "downloads": -1, "filename": "pyimmutable-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3979d93affdfd680cd8dff98b883e089", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 79845, "upload_time": "2018-12-26T21:01:25", "upload_time_iso_8601": "2018-12-26T21:01:25.008517Z", "url": "https://files.pythonhosted.org/packages/f5/1c/db64e45828d82811ece18b42021b6f003e1d3b107131ed5ef3590a5a8b6b/pyimmutable-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "b7cfafcb294f020023220fe66e4d036c", "sha256": "92249a3bfd4dd90a22e948425af8a6ad29d124bad06e3263cdd6b7738e2b7134" }, "downloads": -1, "filename": "pyimmutable-0.1.1-py3.7-linux-x86_64.egg", "has_sig": false, "md5_digest": "b7cfafcb294f020023220fe66e4d036c", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 762886, "upload_time": "2019-01-09T10:48:17", "upload_time_iso_8601": "2019-01-09T10:48:17.502361Z", "url": "https://files.pythonhosted.org/packages/90/79/71af740ddd8e15b2b766634d951b3d7c7c247da5baa6b3b975dadd038b6e/pyimmutable-0.1.1-py3.7-linux-x86_64.egg", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "58100cb0979fd79c3fe2f8c17137f4eb", "sha256": "af68288349b24b874d39664839d4449bdf90f7e06bf516cde26f1d889e65f249" }, "downloads": -1, "filename": "pyimmutable-0.1.1.tar.gz", "has_sig": false, "md5_digest": "58100cb0979fd79c3fe2f8c17137f4eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 80159, "upload_time": "2019-01-09T10:45:09", "upload_time_iso_8601": "2019-01-09T10:45:09.482283Z", "url": "https://files.pythonhosted.org/packages/9d/2f/5f29a09131ccbd771ca4b535313f3e3e3725419fe7a20a42b9c80f3021b1/pyimmutable-0.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "180d93806f8d1228945a07120a1865be", "sha256": "ec127637677316de72b1fbfd657c58e6af05ba4aaa6b5654cf275567eb05433a" }, "downloads": -1, "filename": "pyimmutable-0.1.3-py3.7-linux-x86_64.egg", "has_sig": false, "md5_digest": "180d93806f8d1228945a07120a1865be", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 776801, "upload_time": "2019-10-29T12:38:35", "upload_time_iso_8601": "2019-10-29T12:38:35.735632Z", "url": "https://files.pythonhosted.org/packages/27/9b/08e42c6528397fe9bd591dbae12aad83fef9c22a32845cd9ff14c4eca36a/pyimmutable-0.1.3-py3.7-linux-x86_64.egg", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "14d776b4142d95586a080b40c6297a4a", "sha256": "8cbf97617606dcd551558d84a8cab1dc4c2b6581f8ed7bca7ad5b8b112e5a962" }, "downloads": -1, "filename": "pyimmutable-0.1.3.tar.gz", "has_sig": false, "md5_digest": "14d776b4142d95586a080b40c6297a4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 83921, "upload_time": "2019-10-29T12:38:05", "upload_time_iso_8601": "2019-10-29T12:38:05.206892Z", "url": "https://files.pythonhosted.org/packages/a0/07/e38b165fa56f372f2df1515246c8359dab88ec11af7bc120a012c3631c3c/pyimmutable-0.1.3.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "3986ad819e687e285dc58111afd8ed86", "sha256": "b5df42a4323d3c9a96562311529dccec5565d97e728285624cb594f2d9e84f3c" }, "downloads": -1, "filename": "pyimmutable-0.1.4-py3.7-linux-x86_64.egg", "has_sig": false, "md5_digest": "3986ad819e687e285dc58111afd8ed86", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 824485, "upload_time": "2019-11-05T15:49:04", "upload_time_iso_8601": "2019-11-05T15:49:04.938668Z", "url": "https://files.pythonhosted.org/packages/35/94/f4ea1594c86017b4655583e95dc7afbea38e334cd3ed69414b3ba5b02197/pyimmutable-0.1.4-py3.7-linux-x86_64.egg", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "af0f8f9ed72aa3af7745053daedf803e", "sha256": "6569f55e2eb3f03981c2d21fcdc1125601bfb5bb7094e6b9bafb5cb36c3ed8e0" }, "downloads": -1, "filename": "pyimmutable-0.1.4.tar.gz", "has_sig": false, "md5_digest": "af0f8f9ed72aa3af7745053daedf803e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 90330, "upload_time": "2019-11-05T15:49:26", "upload_time_iso_8601": "2019-11-05T15:49:26.222594Z", "url": "https://files.pythonhosted.org/packages/5e/f9/2f01496e08d648bfc0a70e666770745daf71e7ea836801070a0397734b22/pyimmutable-0.1.4.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "19bc14064266fe2023190a5cc57cca0d", "sha256": "c84913670adce53245394ad072948630ea3d6b37448c9738f18a8ea18f4cee33" }, "downloads": -1, "filename": "pyimmutable-0.2.0-py3.7-linux-x86_64.egg", "has_sig": false, "md5_digest": "19bc14064266fe2023190a5cc57cca0d", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 146372, "upload_time": "2019-11-07T12:04:32", "upload_time_iso_8601": "2019-11-07T12:04:32.302756Z", "url": "https://files.pythonhosted.org/packages/5a/12/e59838696255020684111c9536247d745a708ba1d0b3dd52d9deda8cf3b8/pyimmutable-0.2.0-py3.7-linux-x86_64.egg", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "930c96e5ec1b1fd49466d50931e684f4", "sha256": "2eac567b0863703a8de001316ccde8bddb642516617d37bb70d976fb09b92817" }, "downloads": -1, "filename": "pyimmutable-0.2.0.tar.gz", "has_sig": false, "md5_digest": "930c96e5ec1b1fd49466d50931e684f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 90813, "upload_time": "2019-11-07T12:04:34", "upload_time_iso_8601": "2019-11-07T12:04:34.540045Z", "url": "https://files.pythonhosted.org/packages/c5/d4/5710c550a3263e7dcd009f88a6a7ca7a1c3ccc19f2efbb4df108e9305f0e/pyimmutable-0.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "d64be4b0c910151cbe706beb057c640e", "sha256": "43315bd721018e13889465abb807cc1c5e0e25a10eb42916e3e84deb6a0f9221" }, "downloads": -1, "filename": "pyimmutable-0.2.1-py3.7-linux-x86_64.egg", "has_sig": false, "md5_digest": "d64be4b0c910151cbe706beb057c640e", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 133636, "upload_time": "2020-01-12T11:48:30", "upload_time_iso_8601": "2020-01-12T11:48:30.379828Z", "url": "https://files.pythonhosted.org/packages/5b/72/94cad8212bfb71f63f2013d2193d459697cc3f3965e9a6ed4c8553889a2c/pyimmutable-0.2.1-py3.7-linux-x86_64.egg", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "ac34fd7ff48d8e3b7832765e645a19fe", "sha256": "35d36ec93b07a92603549039080e5b3e66df6e03d309aa2c8a414126169211ea" }, "downloads": -1, "filename": "pyimmutable-0.2.1.tar.gz", "has_sig": false, "md5_digest": "ac34fd7ff48d8e3b7832765e645a19fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 90817, "upload_time": "2020-01-12T11:48:32", "upload_time_iso_8601": "2020-01-12T11:48:32.202665Z", "url": "https://files.pythonhosted.org/packages/e7/aa/1d7cd70c50edba1072fed93640b0b34d56416c18f8953a7c729ccd388b0d/pyimmutable-0.2.1.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d64be4b0c910151cbe706beb057c640e", "sha256": "43315bd721018e13889465abb807cc1c5e0e25a10eb42916e3e84deb6a0f9221" }, "downloads": -1, "filename": "pyimmutable-0.2.1-py3.7-linux-x86_64.egg", "has_sig": false, "md5_digest": "d64be4b0c910151cbe706beb057c640e", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 133636, "upload_time": "2020-01-12T11:48:30", "upload_time_iso_8601": "2020-01-12T11:48:30.379828Z", "url": "https://files.pythonhosted.org/packages/5b/72/94cad8212bfb71f63f2013d2193d459697cc3f3965e9a6ed4c8553889a2c/pyimmutable-0.2.1-py3.7-linux-x86_64.egg", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "ac34fd7ff48d8e3b7832765e645a19fe", "sha256": "35d36ec93b07a92603549039080e5b3e66df6e03d309aa2c8a414126169211ea" }, "downloads": -1, "filename": "pyimmutable-0.2.1.tar.gz", "has_sig": false, "md5_digest": "ac34fd7ff48d8e3b7832765e645a19fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 90817, "upload_time": "2020-01-12T11:48:32", "upload_time_iso_8601": "2020-01-12T11:48:32.202665Z", "url": "https://files.pythonhosted.org/packages/e7/aa/1d7cd70c50edba1072fed93640b0b34d56416c18f8953a7c729ccd388b0d/pyimmutable-0.2.1.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }