[Numpy-discussion] Re: [SciPy-dev] New release on Monday
Travis Oliphant
oliphant.travis at ieee.org
Sun Dec 11 20:38:01 EST 2005
Ed Schofield wrote:
>On 11/12/2005, at 8:53 AM, Travis Oliphant wrote:
>
>
>Is there any chance of including type checking for this release for
>unsafe in-place operations? Several people supported the idea in the
>thread [In-place operators and casting] a few weeks ago. In summary,
>the existing behaviour would still be achievable with an explicit cast:
> >>> my_int_array += my_float_array.astype(int)
>
>
Actually, this would not do the same thing because it would force the
entire float array into memory as an integer array and then add it. The
current behavior creates only bufsize memories for this kind of
copying. So, for large-array performance this approach would be worse,
which is a big reason I'm not really supportive of a switch.
I'm also hesitant to change this because it is the default behavior of
numarray, so I'd like to receive more feedback from members of that
community who are coming over to scipy_core before doing something
different. I think, however, Numeric raises an error in this circumstance.
So, I would advise changing this behavior in the current release, but I
don't see this issue as closed. While I would never support changing
the data-type of the array when using an inplace operator, I could see
the logic in raising an error when the type cannot be cast safely.
-Travis
More information about the NumPy-Discussion
mailing list