Better dict of dicts

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sat Apr 21 15:43:26 EDT 2007


Bill Jackson a écrit :
> I have a dictionary of dictionaries where the keys are typically very 
> long tuples and repeated in each inner dictionary.  The dictionary 
> representation is nice because it handles sparseness well...and it is 
> nice to be able to look up values based on a string rather than a 
> number.  However, since my keys are quite long, I worry that I am 
> wasting a lot of memory.  I'm looking for better data structures.
> 
Is this actually a *real* problem (or do you have evidences - based on 
both measurements of the behaviour with test data sets and knowledge of 
the real data sets- that there will be a problem) ? Or this this just 
"worrying" ? In the second case, I suggest that you bench and profile 
your code to know for sure...



More information about the Python-list mailing list