A Python module who does recursive update work on 2 dicts.
Project description
A Python module who does recursive update work on 2 dicts.
Usage
Installation
pip install dict-recursive-update
Examples
>>> recursive_update({'a': {'b': 2}}, {'a': {'b': 3, 'd': 4}, 'e': 5})
{'a': {'b': 3, 'd': 4}, 'e': 5}
>>> recursive_update('a', 'b')
Traceback (most recent call last):
...
TypeError: Params of recursive_update should be dicts
>>> recursive_update({'a': [1]}, {'a': [2], 'c': {'d': {'c': 3}}})
{'a': [2], 'c': {'d': {'c': 3}}}
>>> recursive_update({'a': {'c': 1, 'd': {}}, 'b': 4}, {'b': 5})
{'a': {'c': 1, 'd': {}}, 'b': 5}
>>> recursive_update({'a': {'c': 1, 'd': {}}, 'b': 4}, {'a': 2})
{'a': 2, 'b': 4}
Why?
This is originally designed for merge multiple configurations in different running environment such as production or stage.
As a node.js developer, package config and lodash are very handy for me. This package is the base of a python-version config package.
In a normal project, there is usually a copy of default configuration, but when we deploy it, some configurations differ from default ones like database address. So a handy configuration-loading package is supposed to load right configurations according to the running environment.
License
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
Built Distribution
Hashes for dict-recursive-update-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f24dc6e33daf4d217c7c075dfff6d0da1c1ded7bc1c110b778290e427cb934b1 |
|
MD5 | d34f146d3d627aa7f6e485b4cf973aeb |
|
BLAKE2b-256 | 9b068a0b9e66bb3c7ce16a926e259e70485ead1811a30fd6b9ca009f9dbd5ce7 |
Hashes for dict_recursive_update-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d23fb17bc06dfdf4260b44d1c1e9a3debad176eb5b95c73eec0aac18c2cab93 |
|
MD5 | 87e68bebb5513fc9b2ff486e4ce52037 |
|
BLAKE2b-256 | 197987b3a5b76228429c80448190cb453ed384cc27b8d7afe06d25c82580c44a |