title: Using linalg.block_diag for variable number of blocks
body: <p>So I have a code that generates various matrices. These matrices need to be stored in a block diagonal matrix. This should be fairly simply as I can use scipy's:</p>
  
  <pre><code>scipy.linalg.block_diag(*arrs)
  </code></pre>
  
  <p>However the problem I have is I don't know how many matrices will need to be stored like this. I want to keep things as simply as possible (naturally). I thought of doing something like:</p>
  
  <pre><code>scipy.linalg.block_diag( matrix_list[ii] for ii in  range(len(matrix_list)) )
  </code></pre>
  
  <p>But this doesn't work. I can think of a few other ways to do it... but they all become quite convoluted for something I feel should be much simpler.</p>
  
  <p>Does anyone have an idea (or know) a simple way of carrying this out?</p>
  
  <p>Thanks in advance!</p>