Integer and String Dictionary Keys for Fast Access

Sean 'Shaleh' Perry shalehperry at attbi.com
Thu Oct 3 19:38:42 EDT 2002


On Thursday 03 October 2002 16:18, Lance wrote:
> Hi,
>
> I'd like each element of a dictionary to have two keys, one a string and
> the other an integer. Each of course would be unique relative to the other
> keys and associated with a single dictionary value.
>
> The advantage is that key lookups by integer are no doubt much faster than
> by strings. At least that's what I find with GAUSS, a matrix programming
> language. GAUSS let's users refer to a dictionary value by its string key
> or integer key. Referring to the value by its integer key significantly
> speeds execution in optimization routines.
>
> Any suggestions?
>
> Thanks in advance.
> Lance

test it out in python, you may be surprised.  I don't think the type really 
matters for dictionary look ups.




More information about the Python-list mailing list