Here's a curiosity. float("nan") can occur multiple times in a set or as a key in a dict: >>> {float("nan"), float("nan")} {nan, nan} except that sometimes it can't: >>> nan = float("nan") >>> {nan, nan} {nan}