Dynamic Dictionary Class
Project description
DynDict
Dynamic Dictionary class for Python adds support for add operation for dictionary classes.
Demo
Python 3.8.3 (default, May 17 2020, 18:15:42)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from dyndict import dyndict
>>> dyn = dyndict()
>>> dyn
{}
>>> dyn += {'a': 1}
>>> dyn
{'a': 1}
>>> dyn += {'b': 1}
>>> dyn
{'a': 1, 'b': 1}
>>> dyn += {'b': 1}
>>> dyn
{'a': 1, 'b': 2}
>>> dyn += {'list': []}
>>> dyn
{'a': 1, 'b': 2, 'list': []}
>>> dyn += {'list': [1, 2, 3]}
>>> dyn
{'a': 1, 'b': 2, 'list': [1, 2, 3]}
>>> dyn += {'list': [{'z': 26}]}
>>> dyn
{'a': 1, 'b': 2, 'list': [1, 2, 3, {'z': 26}]}
>>> dyn['a']
1
>>> dyn['list'][3]
{'z': 26}
Installation
pip install dyndict
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
dyndict-20.7.2.tar.gz
(2.8 kB
view hashes)