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 + ...
Patrick --- 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 http://www.patricktmarsh.com On Wed, Jan 16, 2013 at 7:24 PM, Nathaniel Smith <n...@pobox.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 > case. > > (Sorry for lack of links to earlier discussion; traveling and on my phone.) > > -n > On 16 Jan 2013 16:42, "Chris Barker - NOAA Federal" <chris.bar...@noaa.gov> > wrote: > >> Patrick, >> >> 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... >> >> -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.bar...@noaa.gov >> _______________________________________________ >> NumPy-Discussion mailing list >> NumPy-Discussion@scipy.org >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion