title: Python equivalence to inline functions or macros
body: <p>I just realized that doing</p>
  
  <pre><code>x.real*x.real+x.imag*x.imag
  </code></pre>
  
  <p>is three times faster than doing</p>
  
  <pre><code>abs(x)**2
  </code></pre>
  
  <p>where x is a numpy array of complex numbers. For code readability, I could define a function like</p>
  
  <pre><code>def abs2(x):
      return x.real*x.real+x.imag*x.imag
  </code></pre>
  
  <p>which is still far faster than abs(x)**2, but it is at the cost of a function call. Is it possible to inline such a function, as I would do in C using macro or using inline keyword?</p>