This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author realead
Recipients congma, mark.dickinson, realead, rhettinger, serhiy.storchaka, tim.peters
Date 2021-06-11.15:51:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:46realeadsetrecipients: + realead, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, congma
2021-06-11 15:51:46realeadsetmessageid: <>
2021-06-11 15:51:46realeadlinkissue43475 messages
2021-06-11 15:51:46realeadcreate