[Numpy-discussion] Do we want scalar casting to behave as it does at the moment?
Thu Jan 3 14:06:57 CST 2013
On Wed, Jan 2, 2013 at 11:24 AM, Nathaniel Smith <email@example.com> wrote:
> This discussion seems to have petered out without reaching consensus
> one way or another. This seems like an important issue, so I've opened
> a bug:
> Hopefully this way we'll at least not forget about it; also I tried to
> summarize the main issues there and would welcome comments.
Consensus in that bug report seems to be that for array/scalar operations like:
np.array(, dtype=np.int8) + 1000 # can't be represented as an int8!
we should raise an error, rather than either silently upcasting the
result (as in 1.6 and 1.7) or silently downcasting the scalar (as in
1.5 and earlier).
The next question is how to handle the warning period, or if there
should be a warning period, given that we've already silently changed
the semantics of this operation, so raising a warning now is perhaps
like noticing that the horses are gone and putting up a notice warning
that we plan to close the barn door shortly. But then again, people
who have already adjusted their code for 1.6 may appreciate such a
Or maybe no-one actually writes dumb things like int8-plus-1000 so it
doesn't matter, but anyway I thought the list should have a heads-up
More information about the NumPy-Discussion