[Numpy-discussion] Difference in astype() for scalars and arrays?

Pauli Virtanen pav at iki.fi
Mon Sep 13 08:16:49 EDT 2010


Mon, 13 Sep 2010 13:51:51 +0200, Lorenz Hüdepohl wrote:
> I'm fiddling with some endianness / binary representation issue and
> stumbled upon this puzzling behavior of astype(): It does not seem to
> work as expected - for me at least ;) - when given a scalar:
> 
>>>> import numpy as np
>>>> np.array(42).astype(">i4").dtype
> dtype('>i4')
>>>> np.array(42, dtype=">i4").astype('>i4').dtype
> dtype('int32')

Doesn't seem correct -- please file a bug ticket.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list