[Numpy-discussion] CASTABLE flag
Travis E. Oliphant
oliphant@enthought....
Mon Jan 7 13:00:24 CST 2008
Charles R Harris wrote:
> Hi All,
>
> I'm thinking that one way to make the automatic type conversion a bit
> safer to use would be to add a CASTABLE flag to arrays. Then we could
> write something like
>
> a[...] = typecast(b)
>
> where typecast returns a view of b with the CASTABLE flag set so that
> the assignment operator can check whether to implement the current
> behavior or to raise an error. Maybe this could even be part of the
> dtype scalar, although that might cause a lot of problems with the
> current default conversions. What do folks think?
That is an interesting approach. The issue raised of having to
convert lines of code that currently work (which does implicit casting)
would still be there (like ndimage), but it would not cause unnecessary
data copying, and would help with this complaint (that I've heard before
and have some sympathy towards).
I'm intrigued.
-Travis O.
More information about the Numpy-discussion
mailing list