[Numpy-discussion] tighten up ufunc casting rule

Gael Varoquaux gael.varoquaux@normalesup....
Thu Jun 2 15:09:45 CDT 2011


On Thu, Jun 02, 2011 at 03:06:58PM -0500, Mark Wiebe wrote:
>    Would anyone object to, at least temporarily, tightening up the default
>    ufunc casting rule to 'same_kind' in NumPy master? It's a one line change,
>    so would be easy to undo, but such a change is very desirable in my
>    opinion.
>    This would raise an exception, since it's np.add(a, 1.9, out=a),
>    converting a float to an int:

>    >>> a = np.arange(3, dtype=np.int32)

>    >>> a += 1.9

That's probably going to break a huge amount of code which relies on the
current behavior.

Am I right in believing that this should only be considered for a major
release of numpy, say numpy 2.0?

Gael


More information about the NumPy-Discussion mailing list