
Aug. 26, 2021
8:02 a.m.
On 26/08/2021 09:36, Marc-Andre Lemburg wrote:
In Python you can use a simple test for this:
I think you need math.isnan().
nan = float('nan') l = [1,2,3,nan] d = {nan:1, 2:3, 4:5, 5:nan} s = set(l) nan in l True
That only works with identical nan-s, and because the container omits the equality check for identical objects:
nan = float("nan") nan in [nan] True
But:
nan == nan False nan in [float("nan")] False