Of course all this is nothing new. Python afaik tries to treat NaN in containers as if it compared equal to itself. Is that the best one can do?
What about the following radical proposal: Define Math.nan == Math.nan to be true. It would immediately fix all the inconsistencies with container types. The only purpose of NaN != NaN in the ieee standard seemed to have been to make it simple to detect NaN without having isnan().
Would this be a compatibility problem? Do people detect Math.nan using x != x?