title: Python assign a function to another function
body: <p>I am trying to assign a function to another function the left hand side of the assignment is available to me as a String. For example the body of the method I am looking for is </p>
  
  <pre><code>def change_function_defintion(name_of_function = 'module1.function1'
         , function_object):
      # Can I do eval(name_of_function) = function_object ? will that work?
      pass
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>How do I achieve this? Obviously if I call the above method and then call the module.function1 I expect the new function to be picked up.</li>
  <li>I am doing this in the context of unit testing i.e, Mock several functions, run the test and then basically "unmock" them. Are there any problems with the said approach?</li>
  </ol>