Using bunch
, can Bunch
be used recursively?
For example:
from bunch import Bunch
b = Bunch({'hello': {'world': 'foo'}})
b.hello
>>> {'world': 'foo'}
So, obviously:
b.hello.world
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-effaad77643b> in <module>()
----> 1 b.hello.world
AttributeError: 'dict' object has no attribute 'world'
I know I could do...
b = Bunch({'hello': Bunch({'world': 'foo'})})
...but that's awful.