Hashed dict/list collections
Project description
HashedColls - hashed dict/list collections
Simple Usage
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
).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.
See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for hashedcolls-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9184dd9f776f42dfbe025fa3d4d1eef53f2b3a6ece5fccf5516bf2ce6b0dc81a |
|
MD5 | ea85f62e7fc0df9bc4502432fd43d2af |
|
BLAKE2b-256 | 31e92e88d50aafe3d2a1b80144c976b331860854c2030f6ba89e7d93d14eec91 |