Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
Thorsten Kampe
thorsten at thorstenkampe.de
Sun Jul 31 03:41:45 EDT 2011
* Andrew Berg (Sat, 30 Jul 2011 22:10:43 -0500)
> I'm looking for pointers on design. I'm inexperienced but cautious and
> am mostly wondering if there's an easier way to "format" this data or
> if this approach will lead to problems.
The "QueueItem.x264['avs']['filter']['fft3d']['ffte'])" example does not
look right. Especially the mix of "." and "[]" references. Actually,
dictionaries in a dictionary don't look right to me either.
The design of your data structure won't change. I would think that your
program already mimicks it by nested class statements so you're
duplicating the already existing class structure via dictionaries in
order to have it available in the main class. You say that is necessary
but I'm not convinced it is.
Another approach would be named tuples instead of dictionaries or flat
SQL tables.
Thorsten
More information about the Python-list
mailing list