[issue23204] list.index and rest of list methods disagree if a value is in the list if it's mutated during the call

2015-01-09 Thread Serhiy Storchaka
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

[issue23204] list.index and rest of list methods disagree if a value is in the list if it's mutated during the call

2015-01-09 Thread Raymond Hettinger
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

[issue23204] list.index and rest of list methods disagree if a value is in the list if it's mutated during the call

2015-01-08 Thread Devin Jeanpierre
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) ...