Skip to main content

A sub-class of dict that allows nested key access e.g. a['a.b.c']

Project description

nesteddict

VERSION=0.1.1.alpha

class collections.NestedDict(self, seq=None, **kwargs)

Return an instance of a dict subclass, supporting the usual dict methods. An NestedDict is a dict that that only supports keys of type str. Those keys may be nested by separating them with dots '.'. Hence a valid uses of NestedDict are:

>>> from nesteddict import NestedDict
>>> a=NestedDict()
>>> a['x.y.z']=1
>>> a
{'x': {'y': {'z': 1}}}
>>> a['x.y']
{'z': 1}

Non str keys will throw a KeyError exception.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nesteddict-0.1.3.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

nesteddict-0.1.3-py2.py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 2 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