title: correct and efficient way to flatten array in numpy in python?
body: <p>I have:</p>
  
  <pre><code>a = array([[1,2,3],[4,5,6]])
  </code></pre>
  
  <p>and I'd like to flatten it, joining the two inner lists into one flat array entry. I can do:</p>
  
  <pre><code>array(list(flatten(a)))
  </code></pre>
  
  <p>but that seems inefficient due to the list cast (I want to end up with an array and not a generator.)</p>
  
  <p>Also, how can this be generalized to an array like this:</p>
  
  <pre><code>b = array([[[1,2,3],[4,5,6]], [[10,11,12],[13,14,15]]])
  </code></pre>
  
  <p>where the result should be:</p>
  
  <pre><code>b = array([[1,2,3,4,5,6],
             [10,11,12,13,14,15]])
  </code></pre>
  
  <p>are there builtin/efficient numpy/scipy operators for this? thanks.</p>