fastest table lookup

Michael J. Fromberger Michael.J.Fromberger at Clothing.Dartmouth.EDU
Mon Oct 25 21:00:54 CEST 2004

In article <mailman.5439.1098729682.5135.python-list at>,
 "Neal D. Becker" <ndbecker2 at> wrote:

> I need a fairly small lookup table, and I'm wondering which data python data
> structure would be fastest.  I could use a list, tuple, dictionary, numeric
> array, or maybe plain python array.  The table would be indexed by simple
> integers and would be dense (filled).

My recommendation is that you implement the table, and test your 
implementation on some representative cases.  My sense is that for a 
small, dense table indexed by integers, it would be difficult to beat 
array indexing.  But rather than taking my suppositions for it, why not 
try it out and see?


Michael J. Fromberger             | Lecturer, Dept. of Computer Science  | Dartmouth College, Hanover, NH, USA

More information about the Python-list mailing list