Message390767
I agree hashing a NaN acting like the generic object hash (return rotated address) is a fine workaround, although I'm not convinced it addresses a real-world problem ;-) But why not? It might.
But that's for CPython. I'm loathe to guarantee anything about this in the language itself. If an implementation wants `__contains__()` tests to treat all NaNs as equal instead, or consider them equal only if "is" holds, or never considers them equal, or resolves equality as bitwise representation equality ... all are fine by me. There's no truly compelling case to made for any of them, although "never considers them equal" is least "surprising" given the insane requirement that NaNs never compare equal under IEEE rules, and that Python-the-language doesn't formally support different notions of equality in different contexts. |
|
Date |
User |
Action |
Args |
2021-04-11 04:55:50 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, congma |
2021-04-11 04:55:50 | tim.peters | set | messageid: <1618116950.87.0.676555684184.issue43475@roundup.psfhosted.org> |
2021-04-11 04:55:50 | tim.peters | link | issue43475 messages |
2021-04-11 04:55:50 | tim.peters | create | |
|