3 ms·
This works as expected only because id(math.nan) is always the same, if you build the nan dynamically, it will fail: >>> d = {float('nan'): 1} >>> d
by vhcr 4y ago
This works as expected only because id(math.nan) is always the same, if you build the nan dynamically, it will fail:
>>> d = {float('nan'): 1}
>>> d
{nan: 1}
>>> del d[float('nan')]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: nan