[Numpy-discussion] NaN as dictionary key?

David Cournapeau cournape@gmail....
Mon Apr 20 12:27:25 CDT 2009

On Mon, Apr 20, 2009 at 11:42 PM, Wes McKinney <wesmckinn@gmail.com> wrote:
> I assume that, because NaN != NaN, even though both have the same hash value
> (hash(NaN) == -32768), that Python treats any NaN double as a distinct key
> in a dictionary.

I think that strictly speaking, nan should not be hashable because of
nan != nan. But since that's not an error in python, I am not sure we
should do something about it.


More information about the Numpy-discussion mailing list