Message360507
The following result is a little bit surprising:
>>> nan=float("nan"); ([nan]*5).count(nan)
5
>>> nan == nan
False
But in fact, the optimization doesn't change the value. It was already 5 previously.
In fact, PyObject_RichCompareBool() has a fast path if the two object pointers are equal:
/* Quick result when objects are the same.
Guarantees that identity implies equality. */
if (v == w) {
if (op == Py_EQ)
return 1;
else if (op == Py_NE)
return 0;
}
In short, the optimization is good: thank you ;-) |
|
Date |
User |
Action |
Args |
2020-01-22 21:43:37 | vstinner | set | recipients:
+ vstinner, methane, corona10, pablogsal, miss-islington |
2020-01-22 21:43:36 | vstinner | set | messageid: <1579729416.97.0.712573165188.issue39425@roundup.psfhosted.org> |
2020-01-22 21:43:36 | vstinner | link | issue39425 messages |
2020-01-22 21:43:36 | vstinner | create | |
|