You, know, float are inmutable objects, and then 'float(f)' just
returns a new reference to 'f' is 'f' is (exactly) of type 'float'

In [1]: f = 1.234
In [2]: f is float(f)
Out[2]: True

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.

On Fri, Sep 19, 2008 at 1:59 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> Might someone explain this to me?
>
>     >>> x = [1.,np.nan]
>     >>> np.nan in x
>     True
>     >>> np.nan in np.array(x)
>     False
>     >>> np.nan in np.array(x).tolist()
>     False
>     >>> np.nan is float(np.nan)
>     True
>
> Thank you,
> Alan Isaac
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to