Why doesn't array(a, dtype=single, copy=0) downcast a double array.

Charles R Harris charlesr.harris at gmail.com
Mon Oct 16 17:51:50 CDT 2006


On 10/16/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
> Charles R Harris wrote:
> > It seems to me that since the behaviour when copy=0 is to make a copy
> > only if necessary, it should find it necessary and make the downcast.
> > After all, array(a, dtype=single, copy=1) does just that without
> > complaint. Some common code in linalg could be replaced if array and
> > asarray would do that operation.
> >
> Well, the fact that it makes the copy without raising an error is
> different behavior from Numeric and should be considered an unintended
> change.
>
> We definitely should make this consistent for copy=0 or copy=1.  The
> only question, is do we raise the error in both cases or allow the
> conversion in both cases.
>
> The long-standing behavior is to raise the error on possible-loss
> conversion and so my opinion is that we should continue with that
> behavior.


Tradition is tradition. My own preference would be to perform the downcast
on the grounds that if I care enough to specify a data type, then that is
what I want. But I'm late to this particular party ;)

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061016/e6533dbe/attachment-0001.html 
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list