[Numpy-discussion] Is this a bug?

Charles R Harris charlesr.harris@gmail....
Sun Sep 16 14:11:43 CDT 2007

I note a small inconsistency in the use of the out keyword in some

>>> a=array(0)
>>> sometrue([1],out=a).shape
>>> a=array([0])
>>> sometrue([1],out=a).shape
>>> a=array([[0]])
>>> sometrue([1],out=a).shape
(1, 1)
>>> a=array([[0,0]])
>>> sometrue(eye(2),axis=1,out=a).shape
(1, 2)

It seems to me that all but the first case should raise an error, as the
shape of the output array is not the same as the expected output. I know
this looks picky, but 0d arrays can't be indexed, whereas 1d and 2d arrays
can, so they aren't quite compatible. Besides, the current behavior is
difficult to describe for the documentation. If the current behavior is the
rule, what is that rule?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070916/68f3421b/attachment.html 

More information about the Numpy-discussion mailing list