Serhiy Storchaka added the comment:
This is because list.index() has start and stop parameters, and L.index(x) is
equivalent to L.index(x, 0, len(L)). In list.count() and list.remove() the
limit is dynamic during iteration, but in list.index() it is specified by
arguments before iterating. It
Raymond Hettinger added the comment:
This is a non-guaranteed behavior. It is allowed to be different from other
list methods. The behavior is also very old, stable, and has not been a
problem in practice. No good would come from changing it.
--
nosy: +rhettinger
resolution: -> not
New submission from Devin Jeanpierre:
>>> class AppendOnUnequal(object):
... def __init__(self, append_to):
... self.append_to = append_to
... def __eq__(self, other):
... if self is other:
... return True
... self.append_to.append(self)
... ret