hashedcolls


Namehashedcolls JSON
Version 1.1.1 PyPI version JSON
download
home_page
SummaryHashed dict/list collections
upload_time2023-05-13 20:52:54
maintainer@jedi2light
docs_urlNone
author@jedi2light
requires_python>=3.6
licenseWTFPL
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # HashedColls - hashed dict/list collections

## Simple Usage

```python3
from hashedcolls import HashedDict
from hashedcolls import HashedList

d = HashedDict
l = HashedList

my = d({d({1: 1}): 1, l([1, 2, 3]): 2, (1,): 3})
```

## How it works?

By default, `dict` and `list` Python 3 collections can not be used
as a key for a `dict`,  because they are mutable, thus are not `hashable`.  
But both `HashedDict` and `HashedList` contain `__hash__()` method implemented.  
How it works is that both of these classes have `Hashed` mixin included,
so they are able to use `Hashed.elements2hash()` function,
that basically returns `__hash__()` of all elements (`items()` in case of a `dict`).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "hashedcolls",
    "maintainer": "@jedi2light",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "jedi2light@jedi2light.moe",
    "keywords": "",
    "author": "@jedi2light",
    "author_email": "jedi2light@jedi2light.moe",
    "download_url": "",
    "platform": null,
    "description": "# HashedColls - hashed dict/list collections\n\n## Simple Usage\n\n```python3\nfrom hashedcolls import HashedDict\nfrom hashedcolls import HashedList\n\nd = HashedDict\nl = HashedList\n\nmy = d({d({1: 1}): 1, l([1, 2, 3]): 2, (1,): 3})\n```\n\n## How it works?\n\nBy default, `dict` and `list` Python 3 collections can not be used\nas a key for a `dict`,  because they are mutable, thus are not `hashable`.  \nBut both `HashedDict` and `HashedList` contain `__hash__()` method implemented.  \nHow it works is that both of these classes have `Hashed` mixin included,\nso they are able to use `Hashed.elements2hash()` function,\nthat basically returns `__hash__()` of all elements (`items()` in case of a `dict`).\n",
    "bugtrack_url": null,
    "license": "WTFPL",
    "summary": "Hashed dict/list collections",
    "version": "1.1.1",
    "project_urls": {
        "Bug Tracker": "https://gitlab.com/jedi2light/hashedcolls/issues",
        "Source": "https://gitlab.com/jedi2light/hashedcolls.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7948b0bc375bdbe9fe8896b950974f0dccc47c2dfa6deae66e150ff8ae3c9d71",
                "md5": "2c716390c7469aabad8b728cb7648ee2",
                "sha256": "8a0038ad158c30f18f8344aa3da7f9ce92349860fc1195d8c05063ba147a218e"
            },
            "downloads": -1,
            "filename": "hashedcolls-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c716390c7469aabad8b728cb7648ee2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 2610,
            "upload_time": "2023-05-13T20:52:54",
            "upload_time_iso_8601": "2023-05-13T20:52:54.930831Z",
            "url": "https://files.pythonhosted.org/packages/79/48/b0bc375bdbe9fe8896b950974f0dccc47c2dfa6deae66e150ff8ae3c9d71/hashedcolls-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-13 20:52:54",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "jedi2light",
    "gitlab_project": "hashedcolls",
    "lcname": "hashedcolls"
}
        
Elapsed time: 0.06932s