[Numpy-discussion] Fix to #789 maybe not right.

Charles R Harris charlesr.harris at gmail.com
Wed May 21 22:48:45 EDT 2008


David,

I'm not sure that fix is completely correct. The out keyword is funny and
I'm not what the specs are supposed to be, but generally the output is cast
rather than an error raised. We need an official spec here because the
documentation of this feature is essentially random. Note that the shapes
don't really have to match, either.

In [1]: x = ones(5)

In [2]: out = ones(5, dtype=int8)

In [3]: cumsum(x, out=out)
Out[3]: array([1, 2, 3, 4, 5], dtype=int8)

In [4]: out = empty((5,1))

In [5]: cumsum(x, out=out)
Out[5]:
array([[ 1.],
       [ 2.],
       [ 3.],
       [ 4.],
       [ 5.]])

OTOH, out = empty((1,5)) doesn't work but doesn't raise an error. Confused?
Me too.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080521/bc99e2b4/attachment.html>


More information about the NumPy-Discussion mailing list