From: Stefan v. d. W. <st...@su...> - 2006-08-30 12:04:38
|
On Tue, Aug 29, 2006 at 10:49:58AM -0600, Travis Oliphant wrote: > Matt Knox wrote: > > is the following behaviour expected? or is this a bug with=20 > > numpy.object_ ? I'm using numpy 1.0b1 > > =20 > > >>> print numpy.array([],numpy.float64).size > > 0 > > > > >>> print numpy.array([],numpy.object_).size > > 1 > > > > Should the size of an array initialized from an empty list not always= =20 > > be 1 ? or am I just crazy? > > =20 > Not in this case. Explictly creating an object array from any object=20 > (even the empty-list object) gives you a 0-d array containing that=20 > object. When you explicitly create an object array a different sectio= n=20 > of code handles it and gives this result. This is a recent change, and= =20 > I don't think this use-case was considered as a backward incompatibilit= y=20 > (which I believe it is). Perhaps we should make it so array([],....)=20 > always returns an empty array. I'm not sure. Comments? The current behaviour makes sense, but is maybe not consistent: N.array([],dtype=3Dobject).size =3D=3D 1 N.array([[],[]],dtype=3Dobject).size =3D=3D 2 Regards St=E9fan |