[Numpy-discussion] Tests for empty arrays

Timothy Hochberg tim.hochberg@ieee....
Tue May 6 11:43:13 CDT 2008

On Tue, May 6, 2008 at 9:31 AM, Andy Cheesman <Andy.cheesman@bristol.ac.uk>

> Hi nice numpy people
> I was wondering if anyone could shed some light on how to distinguish an
> empty array of a given shape and an zeros array of the same dimensions.

An empty array is just uninitialized, while a zeros array is initialized to
zeros. Short of checking whether the zeros array is all zeros, which only
tells you that it looks like it was coming from zeros; it still could have
created by by empty or zeros or some other method.

Why do you need to know? If the array is coming from an unknown source, why
not just use a.fill(0) to force everything to be zero and start from a known

> Thanks
> Andy
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

. __
. |-\
. tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080506/4aac1d6e/attachment.html 

More information about the Numpy-discussion mailing list