title: Pass a formula as a function parameter in python
body: <p>I want to pass a formula within a function parameter in Python where the formula is a combination of the other function parameters. In principle this would look like this:</p>
  
  <pre><code>myfunction(x=2,y=2,z=1,formula="x+2*y/z")
  6
  </code></pre>
  
  <p>or more generaly:</p>
  
  <pre><code>def myformula(x,y,z,formula):
     return formula(x,y,z)
  </code></pre>
  
  <p>This would allow the user to choose any arithmetic expression in terms of x, y, and z without having to create a new function.</p>
  
  <p>One of the possibility I foresee is to convert the string in line of code within the function. Anything possible like that in Python? Or any other ideas?
  Thanks</p>