Skip to content

RoDict is dictionary update for python which can be used for accessing internal keys of a dictionary from root key. It saves the tedious task of going inside a dictionary to access some internal keys.

License

Notifications You must be signed in to change notification settings

Prashant-Surya/rodict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoDict

A python package for accessing internal keys of a dictionary easily. RoDict internally stores the data as a dictionary.

Any internal keys of a dictionary by using a key by separating the nested keys using a separator. Default separator is __ (two underscores).

For example consider the following dictionary:

data = {
	'a' : {
		'b': {
			'c': 10
		}
	}
}

Accessing value of key 'c' in the above dictionary:

Without RoDict

>>> data = data['a']
>>> data = data['b']
>>> data = data['c']
>>> print data

With RoDict

>>> from rodict import RoDict
>>> r = RoDict(store=data)
>>> print r['a__b__c']

Not only for getting values, setting values for a key in dict can be done using the same syntax.

Where can it be used:

Right now I'm using this package for maintaining/updating configuration files in json where values need to be dynamically updating during runtime.

Installation:

For contribution:

$ git clone [email protected]:Prashant-Surya/rodict.git
$ cd rodict
$ python setup.py develop

Just for using it as a package:

$ git clone [email protected]:Prashant-Surya/rodict.git
$ cd rodict
$ python setup.py install

Contribution:

  1. For contributing to the RoDict create a fork from this repo.
  2. Work on a feature branch.
  3. Raise a Pull Request to the master branch of this repo.

About

RoDict is dictionary update for python which can be used for accessing internal keys of a dictionary from root key. It saves the tedious task of going inside a dictionary to access some internal keys.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages