[Numpy-discussion] CASTABLE flag

Anne Archibald peridot.faceted@gmail....
Mon Jan 7 14:24:17 CST 2008


On 07/01/2008, Timothy Hochberg <tim.hochberg@ieee.org> wrote:

> I'm fairly dubious about assigning float to ints as is. First off it looks
> like a bug magnet to me due to accidentally assigning a floating point value
> to a target that one believes to be float but is in fact integer. Second,
> C-style rounding is pretty evil; it's not always consistent across
> platforms, so relying on it for anything other than truncating already
> integral values is asking for trouble.

I'm not sure I agree that this is a bug magnet: if your array is
integer and you think it's float, you're going to get burned sooner
rather than later, whether you assign to it or not. The only case I
can see would be a problem would be if zeros() and ones() created
integers - which they don't.

Anne


More information about the Numpy-discussion mailing list