New submission from Marc Guetg:

I propose to change __ne__ of `object` in the following form:

        class NewObject(object):
                def __ne__(self, other):
                        return not self.__eq__(other)

Currently overwriting the `__eq__` method requires also overwriting `__ne__`. 
In a vast majority of cases this results in some boilerplate code as:

    (a == b) ^ (a != b) == True

to reduce surprises. Changing the default behavior still allows for the limited 
number of use cases where we want to implement __ne__ differently.


In short I propose the same behavior than __str__ and __repr__ have for __eq__ 
and __ne__.
(https://docs.python.org/3/reference/datamodel.html#object.__str__)

----------
components: Interpreter Core
messages: 261385
nosy: Marc Guetg
priority: normal
severity: normal
status: open
title: Object defines '__ne__' as 'not __eq__' if '__ne__' is not implemented
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26514>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to