Message395643
This change makes life harder for people trying to get sane behavior with sets for float-, complex- and tuple-objects containing NaNs. With "sane" meaning, that
set([nan, nan, nan]) => {nan}
Until now, one has only to override the equal-comparison for these types but now also hash-function needs to be overriden (which is more complicated e.g. for tuple).
----------------------------------------------------------------
On a more abstract level: there are multiple possible equivalence relations.
The one used right now for floats is Py_EQ and results in float("nan)!=float("nan") due to IEEE 754.
In hash-set/dict we would like to use an equivalence relation for which all NaNs would be in the same equivalence class. Maybe a new comparator is called for (like PY_EQ_FOR_HASH_COLLECTION), which would yield float("nan") equivalent to float("nan") and which should be used in hash-set/dict? |
|
Date |
User |
Action |
Args |
2021-06-11 15:51:46 | realead | set | recipients:
+ realead, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, congma |
2021-06-11 15:51:46 | realead | set | messageid: <1623426706.27.0.21663907392.issue43475@roundup.psfhosted.org> |
2021-06-11 15:51:46 | realead | link | issue43475 messages |
2021-06-11 15:51:46 | realead | create | |
|