[Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

Andrew Collette andrew.collette at gmail.com
Mon Jan 7 16:24:15 EST 2013


Hi Dag,

> But the default float dtype is double, and default integer dtype is at
> least
> int32.
>
> So if you rely on NumPy-supplied default behaviour you are fine!

As I mentioned, this caught my interest because people routinely save
data in HDF5 as int8 or int16 to save disk space.  It's not at all
unusual to end up with these precisions when you read from a file.

> If you specify a smaller dtype for your arrays, you have some reason to do that.

In this case, the reason is that the person who gave me the file chose
to store the data as e.g. int16.  Good default semantics for things
like addition make it easy to write generic code.

Andrew



More information about the NumPy-Discussion mailing list