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

Chris Barker - NOAA Federal chris.barker@noaa....
Fri Jan 18 13:58:50 CST 2013


On Fri, Jan 18, 2013 at 4:39 AM, Olivier Delalleau <shish@keba.be> wrote:
> Le vendredi 18 janvier 2013, Chris Barker - NOAA Federal a écrit :

> If you check again the examples in this thread exhibiting surprising /
> unexpected behavior, you'll notice most of them are with integers.
> The tricky thing about integers is that downcasting can dramatically change
> your result. With floats, not so much: you get approximation errors (usually
> what you want) and the occasional nan / inf creeping in (usally noticeable).

fair enough.

However my core argument is that people use non-standard (usually
smaller) dtypes for a reason, and it should be hard to accidentally
up-cast.

This is in contrast with the argument that accidental down-casting can
produce incorrect results, and thus it should be hard to accidentally
down-cast -- same argument whether the incorrect results are drastic
or not....

It's really a question of which of these we think should be prioritized.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list