[Numpy-discussion] np.nan and ``is``
Alan G Isaac
Fri Sep 19 12:34:51 CDT 2008
> On Fri, Sep 19, 2008 at 1:59 PM, Alan G Isaac <firstname.lastname@example.org> wrote:
>> Might someone explain this to me?
>> >>> x = [1.,np.nan]
>> >>> np.nan in x
>> >>> np.nan in np.array(x)
>> >>> np.nan in np.array(x).tolist()
>> >>> np.nan is float(np.nan)
On 9/19/2008 1:15 PM Lisandro Dalcin apparently wrote:
> I do not remember right now the implementations of comparisons in core
> Python, but I believe the 'in' operator is testing first for object
> identity, and then 'np.nan in [np.nan]' then returns True, and then
> the fact that 'np.nan==np.nan' returns False is never considered.
Sure. All evaluations to True make sense to me.
I am asking about the ones that evaluate to False.
More information about the Numpy-discussion