Best way to handle large lists?

Fredrik Lundh fredrik at pythonware.com
Tue Oct 3 15:07:57 EDT 2006


Hari Sekhon wrote:

> That is surprising since I read on this list recently that lists were 
> faster than dicts

depends on what you're doing with them, of course.

> It was one reason that was cited as to why local vars are better than
 > global vars.

L[int] is indeed a bit faster than D[string] (but not much), but that 
doesn't mean that you can loop over *all* items in a list faster than 
you can look up a single key in a dictionary.

</F>




More information about the Python-list mailing list