Integer and String Dictionary Keys for Fast Access

Lance lbrannma at cablespeed.com
Thu Oct 3 21:29:14 EDT 2002


Yes... I suppose it doesn't matter if everything is a pointer.

Lance

"Sean 'Shaleh' Perry" <shalehperry at attbi.com> wrote in message
news:mailman.1033688407.10786.python-list at python.org...
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