Fast Dictionary Access

Steven D'Aprano steve at
Sun Jun 28 12:23:50 CEST 2009

On Sun, 28 Jun 2009 02:57:50 -0700, Carl Banks wrote:

> So it's not valid in general to equate the two lookups.  Unless you know
> that your dict keys are going to be really fast like interned strings it
> makes sense to minimize dict lookups.

Or to stop making assumptions about what's fast and what's not fast, and 
actually profile the code and see where the hold-ups are.

"Dear Pythonistas, I have a program that runs for six hours performing 
some wickedly complicated calculations on data extracted from a dict. The 
dictionary lookups take five and a half seconds, how can I speed them up?"



More information about the Python-list mailing list