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/2014-July/135363.html below:

[Python-Dev] == on object tests identity in 3.x

[Python-Dev] == on object tests identity in 3.xEthan Furman ethan at stoneleaf.us
Tue Jul 8 04:25:58 CEST 2014
On 07/07/2014 06:58 PM, Steven D'Aprano wrote:
> On Mon, Jul 07, 2014 at 04:52:17PM -0700, Ethan Furman wrote:
>> On 07/07/2014 04:49 PM, Benjamin Peterson wrote:
>>>
>>> Probably the best argument for the behavior is that "x is y" should
>>> imply "x == y", which preludes raising an exception. No such invariant
>>> is desired for ordering, so default implementations of < and > are not
>>> provided in Python 3.
>>
>> Nice.  This bit should definitely make it into the doc patch if not already
>> in the docs.
>
> However, saying this should not preclude classes where this is not the
> case, e.g. IEEE-754 NANs. I would not like this wording (which otherwise
> is very nice) to be used in the future to force reflexivity on object
> equality.
>
> https://en.wikipedia.org/wiki/Reflexive_relation
>
> To try to cut off arguments:
>
> - Yes, it is fine to have the default implementation of __eq__
>    assume reflexivity.
>
> - Yes, it is fine for standard library containers (lists, dicts,
>    etc.) to assume reflexivity of their items.
>
> - I'm fully aware that some people think the non-reflexivity of
>    NANs is logically nonsensical and a mistake. I do not agree
>    with them.
>
> - I'm not looking to change anything here, the current behaviour
>    is fine, I just want to ensure that an otherwise admirable doc
>    change does not get interpreted in the future in a way that
>    prevents classes from defining __eq__ to be non-reflexive.

+1
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