[Numpy-discussion] Casting Bug or a "Feature"?
Wed Jan 16 21:54:40 CST 2013
On Wed, Jan 16, 2013 at 10:43 PM, Patrick Marsh
> Thanks, everyone for chiming in. Now that I know this behavior exists, I
> can explicitly prevent it in my code. However, it would be nice if a warning
> or something was generated to alert users about the inconsistency between
> var += ... and var = var + ...
Since I also got bitten by this recently in my code, I fully agree.
I could live with an exception for lossy down casting in this case.
> Patrick Marsh
> Ph.D. Candidate / Liaison to the HWT
> School of Meteorology / University of Oklahoma
> Cooperative Institute for Mesoscale Meteorological Studies
> National Severe Storms Laboratory
> On Wed, Jan 16, 2013 at 7:24 PM, Nathaniel Smith <email@example.com> wrote:
>> This is separate from the scalar casting thing. This is a disguised
>> version of the discussion about what we should do with implicit casts caused
>> by assignment:
>> into_array[i] = 0.5
>> Traditionally numpy just happily casts this stuff, possibly mangling data
>> in the process, and this has caused many actual bugs in user code. In 1.6
>> some of these assignments cause errors, but we reverted this in 1.7 because
>> this was also breaking things. Supposedly we also deprecated these at the
>> same time, with an eye towards making them errors eventually, but I'm not
>> sure we did this properly, and our carrying rules need revisiting in any
>> (Sorry for lack of links to earlier discussion; traveling and on my
>> On 16 Jan 2013 16:42, "Chris Barker - NOAA Federal"
>> <firstname.lastname@example.org> wrote:
>>> Not a bug but is it a mis-feature?
>>> See the recent thread: "Do we want scalar casting to behave as it does
>>> at the moment"
>>> In short, this is an complex issue with no easy answer...
>>> 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
>>> NumPy-Discussion mailing list
>> NumPy-Discussion mailing list
> NumPy-Discussion mailing list
More information about the NumPy-Discussion