30 Jun
2020
30 Jun
'20
5:22 a.m.
Is there any reason why collections.abc.[Sequence|MutableSequence] do not have "__eq__" for free? I was writing some tests now and was caught by surprise there. (chcking the docs, if my custom MutbaleSequence also inherits from "collections.abc.Set" I will have working "__eq__" - and "__ne__", methods but also weirdly behaved "__le__" and cousins as a side efffect - weird enough I think i will just hand-write the "__eq__") While theoretically adding "__eq__" and "__ne__" _could_ hab backward compatibility issues, I think it is more probable it would actually fix some undetected bugs i a couple projets, as the default __eq__ is an identity comparison (is). Anyway, maybe there is a reason it is not a given. Any thoughts?