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/135334.html below:

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

[Python-Dev] == on object tests identity in 3.x [Python-Dev] == on object tests identity in 3.xAndreas Maier andreas.r.maier at gmx.de
Mon Jul 7 18:56:10 CEST 2014
Am 07.07.2014 17:55, schrieb Ethan Furman:
> On 07/07/2014 04:22 AM, Andreas Maier wrote:
>>
>> Where is the discrepancy between the documentation of == and its
>> default implementation on object documented?
>
> There's seems to be no discrepancy (at least, you have not shown it),

The documentation states consistently that == tests the equality of the 
value of an object. The default implementation of == in both 2.x and 3.x 
tests the object identity. Is that not a discrepancy?


> but to answer the question about why the default equals operation is an
> identity test:
>
>    - all objects should be equal to themselves (there is only one that
> isn't, and it's weird)

I agree. But that is not a reason to conclude that different objects (as 
per their identity) should be unequal. Which is what the default 
implementation does.

>    - equality tests should not, as a general rule, raise exceptions --
> they should return True or False

Why not? Ordering tests also raise exceptions if ordering is not 
implemented.

Andy

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