[issue41397] Restore default implementation of __ne__ in Counter

2020-10-19 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Raymond Hettinger
Raymond Hettinger 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

[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Serhiy Storchaka
Serhiy Storchaka 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__. -- ___ Python tracker

[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: > The problem is that if you subclass Counter and override > its __eq__ method you will need to implement also the > __ne__ method. I don't think that is true. The current code for __ne__ calls "==" and inverts the result. Also, the docstring for the

[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +20768 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21627 ___ Python tracker

[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently collections.Counter implements both __eq__ and __ne__ methods. The problem is that if you subclass Counter and override its __eq__ method you will need to implement also the __ne__ method. Usually you do not need to implement __ne__ because