[Numpy-discussion] PyArray_FromAny silently converts None to a singleton nan

Geoffrey Irving irving@naml...
Mon Jan 28 19:27:45 CST 2013


For comparison:

>>> float32(None)
nan
>>> float(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: float() argument must be a string or a number

On Mon, Jan 28, 2013 at 5:09 PM, Bradley M. Froehle
<brad.froehle@gmail.com> wrote:
>>>> import numpy as np
>>>> np.double(None)
> nan
>
> On Mon, Jan 28, 2013 at 3:48 PM, Geoffrey Irving <irving@naml.us> wrote:
>>
>> I discovered this from C via the PyArray_FromAny function, but here it
>> is in Python:
>>
>>     >>> asarray(None,dtype=float)
>>     array(nan)
>>
>> Is this expected or documented behavior?
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list