What is the best way to store and reference static information that is referred to frequently? Currently, I have a dictionary where each key is associated with a list of lists. For example,
dict = {1:[[1,2,3], [1,2,3,4,5], [1,2,3,4,5,6]],
2:[[2,3,4,5], [1,2,3,4,5,6], [1,2,3,4,5,6]]}
The object of interest is an individual sublist like dict[1][1]
which in this example has value [1,2,3,4,5]
. These dictionaries will have some redundant sublist entries so that for example, [1,2,3,4,5,6]
might show up as the second and third element of a superlist many times.
I will need to extend this to a third level, either through nesting the lists one level further or more likely, making the keys 3-tuples. I might even want to turn the object of interest into a pair of lists so that dict[1][1]
might have value ([1,2,3,4,5],['a','b','c'])
.
My question is, would it make more sense to use an sqlite table rather than a dictionary? Or maybe even some completely different storage format: for example, is there a data format where different keys can point to the same value?