Set builtin lookups

Evan Klitzke evan at yelp.com
Wed Jun 27 02:43:36 EDT 2007


I have a question about the internal representation of sets in Python.
If I write some code like

if x in some_list:
    do_something()

the lookup for the in statement is O(n), where n is the number of
elements in the list. Is this also true if I am using a set or are
sets represented by a hash table?

-- 
Evan Klitzke <evan at yelp.com>



More information about the Python-list mailing list