Message233721
>>> 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)
... return False
...
>>> L = [1]; AppendOnUnequal(L) in L
True
>>> L = [1]; L.count(AppendOnUnequal(L))
1
>>> L = [1]; L.remove(AppendOnUnequal(L))
>>> L = [1]; L.index(AppendOnUnequal(L))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: <__main__.AppendOnUnequal object at 0x7f2562d071d0> is not in list
.index() is the only odd one out here. Looks like a bug to me. |
|
Date |
User |
Action |
Args |
2015-01-09 07:25:48 | Devin Jeanpierre | set | recipients:
+ Devin Jeanpierre |
2015-01-09 07:25:48 | Devin Jeanpierre | set | messageid: <1420788348.75.0.1692375665.issue23204@psf.upfronthosting.co.za> |
2015-01-09 07:25:48 | Devin Jeanpierre | link | issue23204 messages |
2015-01-09 07:25:48 | Devin Jeanpierre | create | |
|