Re: [Numpy-discussion] NaN as dictionary key?

2009-04-23 Thread josef . pktd
2009/4/20 Wes McKinney wesmck...@gmail.com: 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. In [76]: a = np.repeat(nan, 10) In [77]: d = {} In [78]: for i, v in

Re: [Numpy-discussion] NaN as dictionary key?

2009-04-23 Thread Bruce Southey
josef.p...@gmail.com wrote: 2009/4/20 Wes McKinney wesmck...@gmail.com: 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. In [76]: a = np.repeat(nan, 10) In [77]: d =

Re: [Numpy-discussion] NaN as dictionary key?

2009-04-20 Thread David Cournapeau
On Mon, Apr 20, 2009 at 11:42 PM, Wes McKinney wesmck...@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