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/2004-May/044948.html below:

[Python-Dev] cmp(x,x)

[Python-Dev] cmp(x,x)Raymond Hettinger python at rcn.com
Mon May 24 16:57:47 EDT 2004
> On Mon, May 24, 2004 at 12:40:21PM +1200, Greg Ewing wrote:
> > What if the list contains a NaN?
> 
> Uh, right.  The whole issue with NaNs is muddy.  Let's focus on
Numeric as
> a
> much saner example of why you need 'a==a' to return something else
than
> True.

More specifically, find a valid use case where bool(a==a) returns False
(because Py_RichCompareBool() still does a boolean coercion on the
result of a.__eq__(b)).

For the use case to be compelling, it would need to justify breaking
things like:

    mylist.append(x)
    assert x in mylist

I don't believe that you will find sane examples.
Identity-implying-equality is a useful and important invariant.  Don't
give it up easily.



Raymond


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