On 18 juil, 13:13, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > 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. > > This is not a meaningful statement unless you at least qualify with the > number of item that are actually checked. For sufficently long sequences > both any() and the for loop take roughly the same amount of time over here. >
Sorry. I used short lists (a list of 20 floats) and the element checked was not in the list. (That was the case I usually deals with in my code.) -- http://mail.python.org/mailman/listinfo/python-list