title: Updating a variable using its current value in Python
body: <p>I am writing a program to produce an image of the Mandelbrot set. The set requires iterating through the formula: z = z_{n-1}^2 + C. The (n-1) refers to the previous value of z in the loop. In my program I have written</p>
  <pre><code>z_new = (self.z)**2.0 + c_number
  self.z = z_new
  </code></pre>
  <p>within a loop.</p>
  <p>Is there a better way in python to update a value using its current value? I'm not sure the <code>+=</code> operator would work here, since the formula requires squaring the current value before adding the complex number, C.</p>