If the variable is an array, you can check for an empty array by using the size attribute. However, it is possible that the variable is a list or a sequence type, in that case, you can use len()
.
The preferable way to check for a zero element is the size attribute. This is because :
a = NumPy.zeros((1,0))
a.size
0
whereas