title: Check if list or array element is empty
body: <p>I know how to check if a list is empty (<a href="https://stackoverflow.com/questions/53513/best-way-to-check-if-a-list-is-empty?rq=1">Best way to check if a list is empty</a>) and how to check if a <code>numpy</code> array is empty (<a href="https://stackoverflow.com/questions/11295609/how-can-i-check-whether-the-numpy-array-is-empty-or-not">How can I check whether the numpy array is empty or not?</a>)</p>
  
  <p>I have an element that can be at times a list, and other times an array. I need to check whether this element is empty, without knowing beforehand which one it is. I can think of doing</p>
  
  <pre><code>if isinstance(a, list):
      if a:
          # do something
  elif a.any():
      # do something
  </code></pre>
  
  <p>But I wonder if there might be a more pythonic way of doing this?</p>