A sub-class of dict that allows nested key access e.g. a['a.b.c']
Project description
nesteddict
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.1a2.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for nesteddict-0.1a2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4ccdf4f3a48585ed7df2d6114c31a9236387aeb04841cf100ce7bafbfac67c6 |
|
MD5 | d7d95d0fbccc824ca015fafe343769c4 |
|
BLAKE2b-256 | 38adee5c2c679271c08822c27e2af29587d52aeb4b9ba672bf7c216e11cb2b92 |