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.0-py3-none-any.whl (2.6 kB view hashes)

Uploaded py3

Supported by

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