[Numpy-discussion] Casting Bug or a "Feature"?
Chris Barker - NOAA Federal
Fri Jan 18 00:23:10 CST 2013
On Thu, Jan 17, 2013 at 5:19 PM, Olivier Delalleau <email@example.com> wrote:
> 2013/1/16 <firstname.lastname@example.org>:
>> On Wed, Jan 16, 2013 at 10:43 PM, Patrick Marsh
>> <email@example.com> wrote:
>> I could live with an exception for lossy down casting in this case.
I'm not sure what the idea here is -- would you only get an exception
if the value was such that the downcast would be lossy? If so, a major
The other option would be to always raise an exception if types would
cause a downcast, i.e:
arr = np.zeros(shape, dtype-uint8)
arr2 = arr + 30 # this would raise an exception
arr2 = arr + np.uint8(30) # you'd have to do this
That sure would be clear and result if few errors of this type, but
sure seems verbose and "static language like" to me.
> Long story short, +1 for warning, -1 for exception, and +1 for a
> config flag that allows one to change to exceptions by default, if
is this for value-dependent or any casting of this sort?
Christopher Barker, Ph.D.
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
More information about the NumPy-Discussion