Recursively access dict via attributes as well as index access?
Recursively access dict via attributes as well as index access? Question: I’d like to be able to do something like this: from dotDict import dotdictify life = {‘bigBang’: {‘stars’: {‘planets’: []} } } dotdictify(life) # This would be the regular way: life[‘bigBang’][‘stars’][‘planets’] = {‘earth’: {‘singleCellLife’: {}}} # But how can we make this work? life.bigBang.stars.planets.earth …