Python interpreter bug

Fredrik Lundh fredrik at pythonware.com
Fri Oct 7 10:22:54 EDT 2005


alainpoint at yahoo.fr wrote:

> Why is it that a membership test needs to call the __cmp__ method?

because the membership test has to check if the tested item is a member
of the sequence. if it doesn't do that, it's hardly qualifies as a membership
test.  from the reference manual:

    For the list and tuple types, x in y is true if and only if there exists an
    index i such that x == y[i] is true.

</F> 






More information about the Python-list mailing list