This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Devin Jeanpierre
Recipients Devin Jeanpierre
Date 2015-01-09.07:25:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420788348.75.0.1692375665.issue23204@psf.upfronthosting.co.za>
In-reply-to
Content
>>> 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.
History
Date User Action Args
2015-01-09 07:25:48Devin Jeanpierresetrecipients: + Devin Jeanpierre
2015-01-09 07:25:48Devin Jeanpierresetmessageid: <1420788348.75.0.1692375665.issue23204@psf.upfronthosting.co.za>
2015-01-09 07:25:48Devin Jeanpierrelinkissue23204 messages
2015-01-09 07:25:48Devin Jeanpierrecreate