ninjecto.utils.dictionary
¶Dictionary and namespaces related utilities.
Namespace
:
Simple dictionary to object class.ninjecto.utils.dictionary.
Namespace
(*args, **kwargs)¶Simple dictionary to object class.
Usage:
>>> ns = Namespace(
... {'one': 100},
... {'two': 300},
... {'two': 400, 'three': {'four': 400}},
... one=200,
... )
>>> ns.two
400
>>> ns.one
200
>>> ns['two']
400
>>> ns['two'] = 300
>>> ns['two']
300
>>> ns.two = 700
>>> ns['two']
700
>>> ns.two
700
>>> ns.three.four
400
>>> ns['three'].four
400
>>> ns['three']['four']
400
Inheritance