I am creating a data structure dynamically that holds car information. The dictionary looks something like this:
cars = {'toyota': {'prius': {'transmission':'automatic', 'mpg':30, 'misc':[]}}}
The outermost dictionary contains car brand (toyota, bmw, etc.), the second dictionary contains model (prius, m5, etc.) and the inner dictionary contains details of the car. Is this the best way to hold this information?
I am both building the data structure and accessing it. I can't really think of another way to do it but the code looks kind of messy with a bunch of:
cars['toyota'].setdefault('prius', {}).setdefault('misc', []).append('hello')