[Numpy-discussion] possible bug with numpy.object_
Travis Oliphant
oliphant.travis at ieee.org
Tue Aug 29 12:49:58 EDT 2006
Matt Knox wrote:
> is the following behaviour expected? or is this a bug with
> numpy.object_ ? I'm using numpy 1.0b1
>
> >>> 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
> be 1 ? or am I just crazy?
>
Not in this case. Explictly creating an object array from any object
(even the empty-list object) gives you a 0-d array containing that
object. When you explicitly create an object array a different section
of code handles it and gives this result. This is a recent change, and
I don't think this use-case was considered as a backward incompatibility
(which I believe it is). Perhaps we should make it so array([],....)
always returns an empty array. I'm not sure. Comments?
-Travis
More information about the NumPy-Discussion
mailing list