[Numpy-discussion] tighten up ufunc casting rule
Thu Jun 2 15:12:11 CDT 2011
On Thu, Jun 2, 2011 at 3:09 PM, Gael Varoquaux <
> On Thu, Jun 02, 2011 at 03:06:58PM -0500, Mark Wiebe wrote:
> > Would anyone object to, at least temporarily, tightening up the
> > ufunc casting rule to 'same_kind' in NumPy master? It's a one line
> > 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?
Absolutely, and that's why I'm proposing to do it in master now, fairly
early in a development cycle, so we can evaluate its effects. If the next
version is 1.7, we probably would roll it back for release (a 1 line
change), and if the next version is 2.0, we probably would keep it in.
I suspect at least some of the code relying on the current behavior may have
bugs, and tightening this up is a way to reveal them.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion