[Numpy-discussion] equality of empty arrays

Thomas, Brian (GE Energy) brian1.thomas@ge....
Mon Oct 11 19:09:26 CDT 2010


I am pretty new user, but I tend to use shape (n.shape) to check empty
array. You can even check n.size to determine if its empty or not.

Regards,
Brian 

-----Original Message-----
From: numpy-discussion-bounces@scipy.org
[mailto:numpy-discussion-bounces@scipy.org] On Behalf Of Vincent Davis
Sent: Monday, October 11, 2010 8:03 PM
To: Discussion of Numerical Python
Subject: [Numpy-discussion] equality of empty arrays

I assume there is some reasoning behind this
>>> m = np.array([])
>>> n = np.array([])
>>> m==n
array([], dtype=bool)

I was expecting somthing like.
>>> m = []
>>> n = []
>>> m==n
True

What is the right way to test if an array is empty?

--
Thanks
Vincent Davis
720-301-3003
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list