[Python-ideas] checking for identity before comparing built-in objects
solipsis at pitrou.net
Fri Oct 5 01:00:10 CEST 2012
On Thu, 4 Oct 2012 17:08:40 +0200
Victor Stinner <victor.stinner at gmail.com>
> PyObject_RichCompareBool() implements this optimization which leads to
> incorrect results:
> nan = float("nan")
> mytuple = (nan,)
> assert mytuple != mytuple # fails
> I think that the optimization should be implemented for Unicode
> strings, but disabled in PyObject_RichCompareBool().
I think we should wait for someone to complain before disabling it.
It's a useful optimization.
Software development and contracting: http://pro.pitrou.net
More information about the Python-ideas