title: Numpy: Functional assignment?
body: <p>Suppose I want to create an array <code>b</code> which is a version of array <code>a</code> with the <code>i</code>'th row set to zero.</p>
  
  <p>Currently, I have to do:</p>
  
  <pre><code>b = a.copy()
  b[i, :] = 0
  </code></pre>
  
  <p>Which is a bit annoying, because you can't do that in lambdas, and everything else in numpy is functional.  I'd like a function similar to theano's <a href="http://deeplearning.net/software/theano/library/tensor/basic.html#theano.tensor.set_subtensor" rel="nofollow">set_subtensor</a>, where you could go</p>
  
  <pre><code>b = a.set_subtensor((i, slice(None)), 0)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>b = np.set_subtensor(a, (i, slice(None)), 0)
  </code></pre>
  
  <p>As far as I can tell, there's nothing like that in numpy.  Or is there?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>The answer appears to be no, there is no such function, you need to define one yourself.  See hpaulj's response.</p>