[issue41397] Restore default implementation of __ne__ in Counter

Raymond Hettinger report at bugs.python.org
Sun Jul 26 15:27:03 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> The current code returns NotImplemented for non-Counter.
> If we want to implement equality comparison with other 
> class we have to override __ne__.

I'm fine with that.  It is not an undue burden and it provides a nudge to be explicit and intentional about the decision.

Setting __ne__ = object.__ne__ is a neat trick, but it is surprising given
Counter's __mro__ and it loses the helpful docstring describing the effect of zero counts.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41397>
_______________________________________


More information about the Python-bugs-list mailing list