[Tutor] Projects (fwd)

Tiger12506 keridee at jayco.net
Thu Jan 24 03:12:56 CET 2008


> Isn't dictionary access faster than list access? Why are three lists
> 'much more efficient'?

Oh no, no, no.  Dictionaries are faster when you are *searching through* for 
a particular value. If you already know the index of the item in the list, 
lists are much faster.

Dictionaries are hash based. Somewhere it has to calculate the hash of the 
key you give it...
These three lists are more efficient in terms of size/output ratio. It 
appeared as if the dictionary that was presented as an example was just 
going to map one to one all of the values from zero to 999,999 (to match my 
list version capabilities). Not only is that bad programming style, it's 
just plain unecessary. 



More information about the Tutor mailing list