[Numpy-discussion] Fix to #789 maybe not right.
Charles R Harris
charlesr.harris@gmail....
Wed May 21 22:02:17 CDT 2008
On Wed, May 21, 2008 at 8:48 PM, Charles R Harris <charlesr.harris@gmail.com>
wrote:
> 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.
>
And I'm not sure self->desc needs its reference count decremented,
PyArray_FromArray is one of those vicious, nasty functions with side effects
and might decrement the count itself. Note that the reference count is not
decremented elsewhere. It's a capital offense to write such functions, but
there it is.
On a lesser note, there is trailing whitespace on every new line except one.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080521/9edb93a6/attachment.html
More information about the Numpy-discussion
mailing list