Skip to main content

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


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

hashedcolls-1.1.1-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page