OK, now I understand: dtype(out) is preserved, whatever that happens to be, not dtype(a) (which is what I thought it meant) - I better clarify. Thanks!
DG On Tue, Jun 29, 2010 at 7:28 PM, Skipper Seabold <[email protected]>wrote: > On Tue, Jun 29, 2010 at 8:50 PM, David Goldsmith > <[email protected]> wrote: > > Hi, folks. Under Parameters, the docstring for > numpy.core.fromnumeric.all > > says: > > > > "out : ndarray, optionalAlternative output array in which to place the > > result. It must have the same shape as the expected output and the type > is > > preserved." [emphasis added].I assume this is a > > copy-and-paste-from-another-docstring "typo" (shouldn't it be (possibly > > ndarray of) bool), but I just wanted to double check. > > > > Looks right to me though there is no > > In [255]: a = np.ones(10) > > In [256]: b = np.empty(1,dtype=int) > > In [257]: np.core.fromnumeric.all(a,out=b) > Out[257]: array([1]) > > In [258]: b.dtype > Out[258]: dtype('int64') > > In [259]: b = np.empty(1,dtype=bool) > > In [260]: np.core.fromnumeric.all(a,out=b) > Out[260]: array([ True], dtype=bool) > > In [261]: b.dtype > Out[261]: dtype('bool') > > In [262]: b = np.empty(1) > > In [263]: np.core.fromnumeric.all(a,out=b) > Out[263]: array([ 1.]) > > In [264]: b.dtype > Out[264]: dtype('float64') > > In [265]: a2 = > np.column_stack((np.ones(10),np.ones(10),np.random.randint(0,2,10))) > > In [266]: b = np.empty(3,dtype=int) > > In [267]: np.core.fromnumeric.all(a2,axis=0,out=b) > Out[267]: array([1, 1, 0]) > > In [268]: b.dtype > Out[268]: dtype('int64') > > This is interesting > > In [300]: b = np.ones(3,dtype='a3') > > In [301]: np.core.fromnumeric.all(a2,axis=0,out=b) > Out[301]: > array(['Tru', 'Tru', 'Fal'], > dtype='|S3') > > Skipper > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- Mathematician: noun, someone who disavows certainty when their uncertainty set is non-empty, even if that set has measure zero. Hope: noun, that delusive spirit which escaped Pandora's jar and, with her lies, prevents mankind from committing a general suicide. (As interpreted by Robert Graves)
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
