Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: