title: Check for uniformity of a multidimensional list
body: <p>Following my <a href="https://stackoverflow.com/questions/53126305/pretty-printing-numpy-ndarrays-using-unicode-charachters">other question</a> I was surprised to know that Numpy is pretty loose on the definition of array_like objects. Basically <code>np.array(1)</code> is a valid numpy ndarray of shape <code>()</code> and dimension of <code>0</code>! also <code>np.array([[1,2],[3]])</code> is a valid ndarray of shape <code>(2,)</code> and dimension of <code>1</code>. Basically <code>np.array</code> digs as many dimensions as possible till it reaches nonuniformity or zero-dimensional values. This implementation might be pretty fast, but is not necessarily safe. In fact it is very error prone. if somebody forgets one element of an input list, the function returns no error, leading to other most probably more confusing errors down the code. </p>
  
  <p>I was thinking if it is possible to write a checkArr function to check the homogeneity and uniformity of the multidimensional list, with the least possible overhead. Scavenging over a couple of other SO post I ended up with this recursive solution:</p>
  
  <pre><code>def checkArr(A):
      assert isinstance(A, (list,tuple,range)), 
               "input must be iterable (list, tuple, range)"
      assert all(isinstance(a, type(A[0])) for a in A[1:]), 
               "elements of the input must of a the same type, input must be homogeneous"
      if isinstance(A[0], (list,tuple,range)):
          assert all(len(a)==len(A[0]) for a in A[1:]),
               "elements of the input must of a the same size, input must be uniform"
          [checkArr(a) for a in A]
  </code></pre>
  
  <p>now my question is if this is the fastest solution or more performant/Pythonic implementations are possible? </p>