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
___
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
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
Alan G Isaac 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
not quite -- but I do know that is is tricky -- it
On Sep 19, 2008, at 7:52 PM, Christopher Barker wrote:
I don't know the interning rules, but I do know that you should never
count on them, then may not be consistent between implementations, or
even different runs.
There are a few things that Python-the-language guarantees are singleton
Andrew Dalke wrote:
There are a few things that Python-the-language guarantees are singleton
objects which can be compared correctly with is. Those are:
True, False, None
The empty tuple () and all interned strings are also guaranteed to be
singletons. String interning is used to
On Sep 19, 2008, at 10:04 PM, Christian Heimes wrote:
Andrew Dalke wrote:
There are a few things that Python-the-language guarantees are
singleton
objects which can be compared correctly with is.
The empty tuple () and all interned strings are also guaranteed to be
singletons.
Where's