checking if an object IS in a list

nicolas.pourcelot at gmail.com nicolas.pourcelot at gmail.com
Fri Jul 18 12:27:35 CEST 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