checking if an object IS in a list

nicolas.pourcelot at gmail.com nicolas.pourcelot at gmail.com
Fri Jul 18 06:27:35 EDT 2008


In fact, 'any(myobject is element for element in mylist)' is 2 times
slower than using a for loop, and 'id(myobject) in (id(element) for
element in mylist)' is 2.4 times slower.




More information about the Python-list mailing list