[Numpy-discussion] Regression: in-place operations (possibly intentional)

Charles R Harris charlesr.harris at gmail.com
Tue Sep 18 21:31:27 EDT 2012


On Tue, Sep 18, 2012 at 6:08 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

> <snip>
>
> The relevant setting is in numpy/core/include/numpy/ndarraytypes.h
>
> #define NPY_DEFAULT_ASSIGN_CASTING NPY_SAME_KIND_CASTING
>
> I think that if we want to raise a warning we could define a new rule,
>
> NPY_WARN_SAME_KIND_CASTING
>
> Which would do the same as unsafe, only raise a warning on the way.
>

On second thought, it might be easier to set a warn bit on the usual
casting macros, i.e.,

#define NPY_WARN_CASTING 256
#define NPY_MASK_CASTING 255
#define NPY_DEFAULT_ASSIGN_CASTING (NPY_UNSAFE_CASTING | NPY_WARN_CASTING)

and replace the current checks with masked checks.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120918/4fd542d9/attachment.html>


More information about the NumPy-Discussion mailing list