A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-December/142465.html below:

[Python-Dev] Python semantic: Is it ok to replace not x == y with x != y? (no)

[Python-Dev] Python semantic: Is it ok to replace not x == y with x != y? (no) [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
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__.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4