[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.
R. David Murray
report at bugs.python.org
Fri Aug 19 11:19:17 EDT 2016
R. David Murray added the comment:
I was wondering the same thing recently, thanks for opening this issue.
Here is my use case: I'm implementing a PersistentList, and I want it to be equal to a 'real' list, but not equal to a tuple. Frankly, I hadn't thought about the latter problem before this issue, so my __eq__ code in my concrete class is currently broken. I'll need to explicitly check for list subclasses and PersistentList subclasses. I'm not sure there's any way to "generalize" that. I presume that's why Sequence doesn't have the methods.
The answer would seem to be to have explicit 'List' and 'Tuple' abcs.
----------
nosy: +r.david.murray
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27802>
_______________________________________
More information about the Python-bugs-list
mailing list