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.3.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for nesteddict-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbf7140b6b464b0d1ef02ae36eb0d3b33e67719b32e497def1e018ff4a6fb236 |
|
MD5 | ef6b8aa974ce3425734e743db3352b2c |
|
BLAKE2b-256 | 60042ca49406355540db78abf7091a3e0c456521fef1f10b7dbd7aaf0dbe96a1 |