[Numpy-discussion] Matching 0-d arrays and NumPy scalars
Thu Feb 21 17:43:49 CST 2008
On 21/02/2008, Stefan van der Walt <email@example.com> wrote:
> Could I ask that we also consider implementing len() for 0-d arrays?
> numpy.asarray returns those as-is, and I would like to be able to
> handle them just as I do any other 1-dimensional array. I don't know
> if a length of 1 would be valid, given a shape of (), but there must
> be some consistent way of handling them.
Well, if the length of an array is the product of all its sizes, the
product of no things is customarily defined to be one... whether that
is actually a useful value is another question.
More information about the Numpy-discussion