Dear Experts, How much slower is dict indexing vs. list indexing (or indexing into a numpy array)? I realize that looking up a value in a dict should be constant time, but does anyone have a sense of what the overhead will be in doing a dict lookup vs. indexing into a list? Some ad hoc tests I've done indicate that the overhead is less than 15% (i.e., dict lookups seem to take no more than 15% longer than indexing into a list and there doesn't seem to be much difference in indexing into a list vs. a numpy array).
The reason I ask is because I'm wondering how hard I should work to compute and store an index into a list to avoid repeated hash table lookups. From my tests, it looks like the answer is basically "don't bother". Does anyone have information, thoughts, or comments on this? Thanks, -Emin -- http://mail.python.org/mailman/listinfo/python-list