KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Working with deeply nested python dicts, I would like to be able to assign values in such a data structure like this: mydict[key][subkey][subkey2]="value" without having to check that mydict[key] etc. are actually set to be a dict, e.g. using if not key in mydict: mydict[key]={} The creation of subdictionaries should happen on the fly. What is the most elegant way to allow something equivalent - maybe using decorators on the standard <type 'dict'> ?
Tags (comma-separated)
Save Edits
Cancel