fast list lookup
Alex Martelli
aleaxit at yahoo.com
Wed Jan 26 09:51:14 EST 2005
Klaus Neuner <klaus_neuner82 at yahoo.de> wrote:
> what is the fastest way to determine whether list l (with
> len(l)>30000) contains a certain element?
"if thecertainelement in l:"
is the fastest way unless there are properties of l which you're not
telling us about, or unless what you need is not just to determine
whether l contains a certain element but rather something different
(such as doing the same determination for several elements on an
unchanging l).
Alex
More information about the Python-list
mailing list