John Bauman wrote: > Adam Atlas wrote: >> On Apr 19, 5:24 pm, Bill Jackson <[EMAIL PROTECTED]> wrote: >>> 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 wouldn't worry about it. Try doing hash('string_2') in the >> interpreter -- the output thereof is what's really being used as the >> key. It doesn't use up any more memory than the integer 2. >> > Are you sure about that? Most dictionaries need to store the actual key, > in case of a collision, so when you lookup a key they can tell which > you're really looking for.
Maybe this will help: http://wiki.python.org/moin/DictionaryKeys -Larry -- http://mail.python.org/mailman/listinfo/python-list