[Numpy-discussion] astype None

Keith Goodman kwgoodman at gmail.com
Thu May 20 21:00:39 EDT 2010


While automating some unit tests for my labeled array class, larry, I
assumed that

np.array([1, 2], dtype=dtype)

would give the same result as

np.array([1, 2]).astype(dtype)

But it doesn't for dtype=None:

>> np.array([1, 2, 3], dtype=None)
   array([1, 2, 3])
>> np.array([1, 2, 3]).astype(None)
   array([ 1.,  2.,  3.])

I prefer the behavior of array where dtype=None is a no-op.



More information about the NumPy-Discussion mailing list