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
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 Distribution
nesteddict-0.1.2a0.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for nesteddict-0.1.2a0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce621afda17b51efa662d14ff59be3c2cb36c6a635d9fc9022bbfbf19a044fc6 |
|
MD5 | 907b83e890b53dfc188899ecc0c48025 |
|
BLAKE2b-256 | 9afa5a1acf906f7a85477475354205fcfca2e1d2dc31d20ce465f2fb9a743939 |