[Python-Dev] Python semantic: Is it ok to replace not x == y with x != y? (no)
Serhiy Storchaka
storchaka at gmail.com
Wed Dec 16 04:34:37 EST 2015
More information about the Python-Dev mailing list
Wed Dec 16 04:34:37 EST 2015
- Previous message (by thread): [Python-Dev] Python semantic: Is it ok to replace not x == y with x != y? (no)
- Next message (by thread): [Python-Dev] Urgent: Last call for the CfP of PythonFOSDEM 2016
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 15.12.15 15:04, Victor Stinner wrote: > Should Python emit a warning when __eq__() is implemented but not __ne__()? No. Actually I had removed a number of redundant (and often incorrect) __ne__ implementations after fixing object.__ne__. > Should Python be modified to call "not __eq__()" when __ne__() is not > implemented? __ne__() always is implemented (inherited from object). Default __ne__ implementation calls __eq__() and negate it's result (if not NotImplemented). But user class can define __ne__ with arbitrary semantic. That is the purpose of adding __ne__.
- Previous message (by thread): [Python-Dev] Python semantic: Is it ok to replace not x == y with x != y? (no)
- Next message (by thread): [Python-Dev] Urgent: Last call for the CfP of PythonFOSDEM 2016
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list